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?
Sorry for trolling! Where's the error, guys? A signal is triggered, after 2 bars passes if it meets the condition, then we open a trade.
if (bay == true) datetime T=Time[0] //сработал сигнал на покупку запоминаем время бараif(iBarShift(NULL,0,T)==2) //по времени, сигнал был на 2 баре
{
if (Open[1]<Close[1] && Open[2]<Close[2] ) //и эти бары бичьи
{
// что-то делаем
}
}
Top2n: 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.
staticint T=0;
if (bay == true && T==0) T=Time[0] //сработал сигнал на покупку запоминаем время бараif(iBarShift(NULL,0,T)==2) //по времени, сигнал был на 2 баре
{
if (Open[1]<Close[1] && Open[2]<Close[2] ) //и эти бары бичьи
{
T=0;
// что-то делаем
}
}
Although the most unfortunate option. We should check the signal itself on the right bar
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.
if (Low[4]< MA4 && MA4 < High[4]) //условия если 4-я свеча лежит в скользящей
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).
I deleted a data folder about 3-4 months ago. The recycle bin was emptied. Now I need one file from there. Can anyone suggest a program to recover deleted files?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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 .