In my case it was "<=", but Stochastic values change very strongly even with every tick - there are four more decimal places, i.e. on one tick the values may change from (for example) 75.0003 to 74.0900.
So, the sign "=" can be omitted without any fear. But of course, in order not to think - I think I will.
Looked at the expert - everything seems to be correct. Couldn't check it - no indicator. Try adding Print before OrderClose and see if the close signal appears.
I don't get it! I put this block in another EA. And a third. ... . But the situation has not changed! Positions are not closed. Although seldom, rarely (once or twice on the history = 1 year) and flashes a green triangle close on the visual chart. But it should not be like that! Positions, judging by the code, should close like a sewing machine shuttle!
Maybe this block shouldn't work? After all, we have stops in the code when we open: - stoploss and takeprofit. And maybe all other closing conditions are ignored for this reason?
komposter: I haven't looked at the code. But one thing is for sure: instead of "if(Stochast_1>75 && Stochast_0<75)" I would make "if(Stochast_1>75 && Stochast_0<=75)".
A better way would be: if(Stochast_1-75.0>0 && Stochast_0-75.0<=0) in order to avoid unnecessary conversions of the int and double types.
And how do we avoid unnecessary int and double. ? I can't think of any. Moreover, we may replace numbers with external parameters - extern int Up_lim = 80; extern int Low_lim = 20;
rid: And how do we avoid unnecessary int and double. ? I can't figure it out. Besides, instead of numbers we may use external parameters extern int Up_lim = 80; extern int Low_lim = 20;
Firstly, it is incorrect to compare real Stochast_ and integer 75, and secondly, it is more correct to compare their difference with zero.
In my case it was "<=", but Stochastic values change very strongly even with every tick - there are four more decimal places, i.e. on one tick the values may change from (for example) 75.0003 to 74.0900.
So, the sign "=" can be omitted without any fear. But of course, in order not to think - I think I will.
Try adding Print before OrderClose and see if the close signal appears.
Done. Added. No, .....! The Closing Notice doesn't appear in the logbook.
I don't get it! I put this block in another EA. And a third. ... . But the situation has not changed! Positions are not closed. Although seldom, rarely (once or twice on the history = 1 year) and flashes a green triangle close on the visual chart. But it should not be like that! Positions, judging by the code, should close like a sewing machine shuttle!
The NOnLagMA indicator is uploaded
Maybe this block shouldn't work? After all, we have stops in the code when we open: - stoploss and takeprofit. And maybe all other closing conditions are ignored for this reason?
ticket=OrderSend(Symbol(),0,Lots,Ask,Slippage,Bid-SL_long*Point,Ask+TP_long*Point, NULL,MagicNum, 0,CLR_NONE);
I'll have to deal with it in some other way.
I don't understand anything!
You should be more attentive.)
Here is the start() function of the test variant (without SL and TP, with correct messages and without unnecessary slip):
But I wouldn't use this EA on a real account if I were you. It should be put in order, or in "readiness", if you like ;)
Yes, of course. Thank you for your help! I understand your comment about my mistake.
And have taken note of your recommendations. There's still a long way to go before real trading...
p.s/ Everything is working.... ! And how it worked!
I haven't looked at the code.
But one thing is for sure: instead of "if(Stochast_1>75 && Stochast_0<75)" I would make "if(Stochast_1>75 && Stochast_0<=75)".
A better way would be: if(Stochast_1-75.0>0 && Stochast_0-75.0<=0) in order to avoid unnecessary conversions of the int and double types.
And how do we avoid unnecessary int and double. ? I can't figure it out. Besides, instead of numbers we may use external parameters extern int Up_lim = 80; extern int Low_lim = 20;
Firstly, it is incorrect to compare real Stochast_ and integer 75, and secondly, it is more correct to compare their difference with zero.
'Comparison of real numbers'.