By request of the 'writers' The flip-flop toy. Opens on a new bar to the opposite side after closing the trade
extern double Lots = 0.1; //размера лота при нулевом риске extern double MaximumRisk=5.0; //варьируемый размер риска extern int cmd=OP_BUY; //команда для первого входа extern int TP=200; //Тейкпрофит extern int SL=200; //Стоплосс extern int MagicNumber = 0; //Магическое число
Victor, hello!
It's a pleasure to hold such a toy in your hands. It is rare to find such simple and intelligent code nowadays.
It even made me want to work with it and that's what I managed to work out:
If we only look at the last deal in the history, we can get rid of the loop:
int Signal() { OrderSelect(OrdersHistoryTotal()-1, SELECT_BY_POS, MODE_HISTORY); if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)return(MathAbs(OrderType()-1)); return(-1); }
A very useful toy! It's great to use it to find the optimal values of SL and TP. And beautifully written. Thank you!
At the next request, the next toy.
But the position opens in the same direction if the last trade was profitable, and in the opposite direction if the trade was unprofitable
Parameters are the same
This is no longer a toy. Nor is it an EA, it is an indicator. Full analogue of LSMA, but with a different calculation speed
.FG писал (а):
Age Of Empires посла жнее, но зато и стро ти гичи ски поинти реснея!!! Единственный минус - от Майкра софт! :)
You've got to be kidding me. It's a bust, kid.
Victor, I wanted to ask you a question about the code. You have a similar design:
static int prevtime=0; if(iTime(Symbol(),PERIOD_D1,0) == prevtime) return(0); prevtime = iTime(Symbol(),PERIOD_D1,0);As far as I understand it - it is a check in Expert Advisor for forming a new bar. Could you please explain why it is needed (I think it is used to open an order only when a new bar arrives, but why - when a new bar arrives, Ask may greatly change, and with it the signal to perform a deal?)
Victor, I wanted to ask you a question about the code. You have a similar design:
static int prevtime=0; if(iTime(Symbol(),PERIOD_D1,0) == prevtime) return(0); prevtime = iTime(Symbol(),PERIOD_D1,0);As far as I understand, this is a check in EA for forming a new bar. Can you explain why it is needed (I think it is used to open an order only at the arrival of a new bar, but why - when a new bar arrives, the Ask may greatly change, and with it the signal to perform a deal?)
The customer asked to open a bar, and that is what he got.
Had there been a different task, there would have been a different variant.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use