Order Send in specific timeframe

 
Hi all, I create an EA that works on multi timeframe. The order send function would be initiate in the smallest timeframe. I want to know how I can using order send function to open a position in the smallest timeframe since there isn't any timeframe selection in order send function.

Thank you.
 
Luandre Ezra:
Hi all, I create an EA that works on multi timeframe. The order send function would be initiate in the smallest timeframe. I want to know how I can using order send function to open a position in the smallest timeframe since there isn't any timeframe selection in order send function.

Thank you.

It doesn't matter what time-frame the chart is. OrderSend() sends the order at ask or bid and sets SL TP. What difference would the  time-frame make?

 
Keith Watford:

It doesn't matter what time-frame the chart is. OrderSend() sends the order at ask or bid and sets SL TP. What difference would the  time-frame make?

ah my mistake, I thought OrderSend() works on certain timeframe cause in strategy tester we need to choose which timeframe that we want to use.

 

It doesn't matter what TF the order is sent.

What matters is if you manage the trade afterwards (e.g. trailing.) Then you need to know what TF/strategy the order is from. Using a range of Magic numbers (one per TF per strategy) allows that.

 
William Roeder:

It doesn't matter what TF the order is sent.

What matters is if you manage the trade afterwards (e.g. trailing.) Then you need to know what TF/strategy the order is from. Using a range of Magic numbers (one per TF per strategy) allows that.

I have created the EA and backtest it in H1 period and it works. The problem is when I’m changing the timeframe into M15 to look into when the trade took place because I use M15 to find entry, the backtest wouldn’t open any trade even though in H1 works find. Do you know why this happened?

 
Luandre Ezra: Do you know why this happened?
How To Ask Questions The Smart Way. 2004
          When asking about code

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.

Always post all relevant code.
     How To Ask Questions The Smart Way. 2004
          Be precise and informative about your problem

We can't see your broken code.

Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?

Fix your broken code.

 
William Roeder:
How To Ask Questions The Smart Way. 2004
          When asking about code

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.

Always post all relevant code.
     How To Ask Questions The Smart Way. 2004
          Be precise and informative about your problem

We can't see your broken code.

Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?

Fix your broken code.

Sorry for not giving a clear answer up there. I don’t expect anyone to debug my code or anything. I just hope finding some insight for my problem.

From my statement above, my code works fine in backtesting using H1 period and not working on M15 period. As far as I know period on the backtesting only for visualization and doesn’t affecting how the code works. If in H1 period the code working why on the M15 period TF doesn’t? This is what I’m asking.


and thank you for the debugging link above I sure gonna read it.

Reason: