I think you had to wrap identical indicator calls in a function, the code would be more compact, and who knows, now you're using indicator values for 4 bars, tomorrow for 5 ...
i.e.
int SignalByPuria(constint bar)
{
malw=iMA(NULL,0,MovingPeriodLw,0,MODE_EMA,PRICE_CLOSE,bar);
mas1=iMA(NULL,0,MovingPeriodS1,0,MODE_LWMA,PRICE_LOW,bar);
mas2=iMA(NULL,0,MovingPeriodS2,0,MODE_LWMA,PRICE_LOW,bar);
......
}
sometimes there are indicators that don't have a trade signal on a certain bar. I usually use enum E_CMD{CMD_BUY,CMD_SELL,CMD_NONE};
and then the signature of the "signal" function will beE_CMD SignalByPuria(const int bar) , and the EA code itself will turn into something like this:
I think you should have wrapped the same indicator calls in a function, the code would have been more compact, and who knows, now you use indicator values on 4 bars, tomorrow on 5...
i.e.
sometimes there are indicators that don't have a trade signal on a certain bar. I usually use enum E_CMD{CMD_BUY,CMD_SELL,CMD_NONE};
and then the signature of the "signal" function will beE_CMD SignalByPuria(const int bar) , and the EA code itself will turn into something like this:
imho, this approach allows you to quickly add new trading signals to the already written EA code
MakarFX #: I do not understand why there are fingers?
There are fingers to the fact that it is inappropriate to only place OrderSend, and then not to complain that something is wrong. You always have to look for errors.
If you know of another option, write...
You can help people.)
You make all variables separately in the inite and separate them by further processing (no need to be lazy).
Next, bracket the blocks and compare the return variables.
Make all variables separately in the init and separate them by further processing (no need to be lazy).
Next, bracket the blocks and compare the return variables.
Somewhere like this...
I wanted to post the whole owl, but the forum won't let me.
Which fragment do you want?
Somewhere like this...
Which piece do you want?
Forum on trading, automated trading systems & strategy testing
Any questions from newbies in MQL4 and MQL5, help and discussion on algorithms and codes
MakarFX, 2021.10.08 18:43
I think you had to wrap identical indicator calls in a function, the code would be more compact, and who knows, now you're using indicator values for 4 bars, tomorrow for 5 ...
i.e.
sometimes there are indicators that don't have a trade signal on a certain bar. I usually use enum E_CMD{CMD_BUY,CMD_SELL,CMD_NONE};
and then the signature of the "signal" function will beE_CMD SignalByPuria(const int bar) , and the EA code itself will turn into something like this:
imho, this approach allows you to quickly add new trading signals to the already written EA code
I think you should have wrapped the same indicator calls in a function, the code would have been more compact, and who knows, now you use indicator values on 4 bars, tomorrow on 5...
i.e.
sometimes there are indicators that don't have a trade signal on a certain bar. I usually use enum E_CMD{CMD_BUY,CMD_SELL,CMD_NONE};
and then the signature of the "signal" function will beE_CMD SignalByPuria(const int bar) , and the EA code itself will turn into something like this:
imho, this approach allows you to quickly add new trading signals to the already written EA code
Back to our conversation, here is the market position opening function for MT4
Returns trade flag today
Returns number of positions
All optimised for the current build of the terminal.
All optimised for the current build of the terminal.
I do not understand why there are fingers?
There are fingers to the fact that it is inappropriate to only place OrderSend, and then not to complain that something is wrong. You always have to look for errors.