How to prescribe that at the opening of a candle an order was opened, and at the opening of the next one it was closed and a new one was opened!
Anton Tarasov:
How do I specify that at the opening of a candle an order is opened, and at the opening of the next one it is closed and a new one is opened!
The first thing to do is to specify the platform.
How do I specify that at the opening of a candle an order is opened, and at the opening of the next one it is closed and a new one is opened!
Alexey Kozitsyn:
First you need to specify the platform.
Mt4
First you need to specify the platform.
this is not the right function!!!
It will give one false signal on the first run of the EA
This is the correct and reliable way :
// =========================================================================================================// bool NewBar() { static datetime time=0; datetime cur_time = iTime(Symbol(), PERIOD_CURRENT, 0); if(time==0) { time=cur_time; return false; } if(time!=cur_time) { time=cur_time; return true; } return false; } // =========================================================================================================//
Vladimir Pastushak:
An unnecessary if to the EA is like a rock on the neck.
this is not the right function!!!
It will give one false signal on the first start of the EA
This is the right and reliable way to do it :
Anton Tarasov:
How to prescribe that with the opening of a candle an order was opened, and with the opening of the next candle it was closed and a new one was opened!
If the time of opening of a bar of the order is less than Time[0], then we close it. If there are no orders after that, we open a new one.
How to prescribe that with the opening of a candle an order was opened, and with the opening of the next candle it was closed and a new one was opened!
Dmitry Fedoseev:
An unnecessary if is like a rock on the neck of the EA.
Put a second else then
An unnecessary if is like a rock on the neck of the EA.
bool NEW_BAR() еще короче { static int nBars=0; if(nBars!=Bars) { nBars=Bars; return(true); } return(false); }
Alexey Busygin:
Put the second one down then.
And that's the same as the dick.
Put the second one down then.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register