Reply To: Highest Close between 2 MA Crossovers Signals

Optuma Forums Optuma Scripting Highest Close between 2 MA Crossovers Signals Reply To: Highest Close between 2 MA Crossovers Signals

#53119
Dan
  • Topics: 3
  • Replies: 5
  • Posts: 8

Hi Mathew.

The screenshot attached shows the Blue arrow as the Close Crossing Above 20 Day MA and the Red Arrow shows the Close Crossing Below the 20 Day MA.

There are 4 bars between the Crossovers including the Cross Below in this screenshot.

COND1 is capturing the CrossAbove.

COND2 is capturing the CrossBelow.

T1 is capturing the number of bars since COND1.

I want to make sure that T1 only captures the bars between COND1 and COND2 every time those conditions occur.

I also want the number of  bars <= NUMBARS and 4 <= 10 in this example.

So I am trying to capture these bars using COND3 but I think it is wrong.

After getting each set of bars between COND1 and COND2, I want the find the highest Close price

between them. So if COND3 is True, I am using HIGHESTSINCE(COND1) but believe this is wrong as well.

I want to show a signal at the Highest Close which is represented by the Green Arrow button in the screenshot.

How can this be done?

 

NUMBARS=10;

MA20 = MA(Day(PERIODAMOUNT=1), DATA1, BARS=20, STYLE=Simple, CALC=Close);

Close1 = CLOSE(Day(PERIODAMOUNT=1));

COND1 = Close1 CrossesAbove MA20;

T1 = TIMESINCESIGNAL(COND1);

COND2 = Close1 CrossesBelow MA20;

COND3 = COND2 and (T1 <= NUMBARS) ;

IF(COND3, HIGHESTSINCE(COND1));

 

Pin It on Pinterest