Script to buy or sell

 
Hi

I need to create a script that when my system time hits a certain time of the day a automatic buy or sell order needs to be placed. I figured out the system time thing, but I'm struggling to do the following for the buy / sell:

if the current bar is higher than 12 bars back then the ticket must  sell.

if the current bar is lower than 12 bars back the ticket must buy. 
 
dumb_07070:
Hi

I need to create a script that when my system time hits a certain time of the day a automatic buy or sell order needs to be placed. I figured out the system time thing, but I'm struggling to do the following for the buy / sell:

if the current bar is higher than 12 bars back then the ticket must  sell.

if the current bar is lower than 12 bars back the ticket must buy. 

Hi

 

if ( High[0] > High[12] )
{
   // Sell code goes here
}
else if ( Low[0] < Low[12] )
{
   // Buy code goes here
}
 
Filter:

Hi

 

Hi

 Looks good, I will give it a run and see, thanks :) 

Reason: