Download MetaTrader 5

Script to buy or sell

To add comments, please log in or register
dumb_07070
9
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. 
Stuart Browne
6091
Stuart Browne  
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
}
dumb_07070
9
dumb_07070  
Filter:

Hi

 

Hi

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

To add comments, please log in or register