[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 139
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
Good afternoon. Please advise how to implement the following:
I have an open Buy position. The next candle went strongly downwards and triggered a stop. But as the movement was sharp and the signals still show Buy, a long position will be opened again on the next tick. What lines should be introduced into the code to delay the position opening until the next candle is closed, for example?
And the second question. Can we specify the upward direction of stochastic lines in the code as one of the rules?
Thank you very much.
Sorry for trolling! Where's the error, guys? The signal is triggered, after 2 bars passes if it meets the condition, then we open a trade.
// что-то делаем
Although the most unfortunate option. We should check the signal itself on the right barThe most unfortunate option, though. You need to check the signal itself on the right bar
How do you do that?
How's that?
How do you check the signal? Exactly the same way, but on different bars
How do you do it?
Everything has to be squeezed out of you one drop at a time.
if (StochM < St_min && StochS < St_min)
bay_min = true;
Do this check for bars 2 more.
Try it this way:
Thank you!!! That's just what you need. The first brick is laid.
But I thought, I don't need to change Startprice value every minute and check the condition.
I need to check the condition at the close of the candle timeframe, and if it is consistent with the value of the variable Startprice posted value of the last candle.
So, we have to check it on bar close. I do not know how to do it. I will not be able to handle it myself if you just add 0+0).
If it bothers me that the sliding indicator has been applied to close prices, we may change it to open prices as well. It makes no difference to me.
Please help me with code or thinking. If it's the latter, I'll have to work on it for a couple of months).
bool NewBar()
{static datetime newbar;
bool res=false;
if(newbar==0)newbar=Time[0];
if(newbar!=Time[0]){res=true;newbar=Time[0];}
return(res);
}
New bar presence .