Download MetaTrader 5

Script to buy or sell

To add comments, please log in or register
Use MQL5 Cloud Network. It is secure!
dumb_07070
9
dumb_07070 2015.04.19 11:40 
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
5814
Stuart Browne 2015.04.20 00:43  
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 2015.04.20 19:22  
Filter:

Hi

 

Hi

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

To add comments, please log in or register