Reply To: SCRIPTING: OFFSET FROM SIGNAL

Optuma Forums Optuma Scripting SCRIPTING: OFFSET FROM SIGNAL Reply To: SCRIPTING: OFFSET FROM SIGNAL

#45055
Henry
  • Topics: 0
  • Replies: 17
  • Posts: 17

Hi Trevor,

Offset() only returns value according to the Bar position instead of the Signal position.

It is a good idea to have a different Offset() that could easily point to the previous / next signal. I will pass it on to the team.

In the meantime, here is the script to look for the signal that is lower than the next signal (using -1 as offset value)

 

GS2ndTopSignal = SCRIPT(SCRIPTNAME=Test);

// use IF()  to give the High at the Signal and fill the other positions with zero

Value1 = If(GS2ndTopSignal > 0, PriceAtSignal(GS2ndTopSignal, PRICE=High), 0);

// Use NonZero()  to shrink the Value1 list by removing the zeros so it can use Offset() to find the next / previous signal

Signal1 = NONZERO(Value1);

Signal1 < OFFSET(Signal1, OFFSET=-1)

Pin It on Pinterest