Most likely, at the moment of opening you have zero in thepriceBUY variable, so Bid-priceBUY(0)==Bid, and therefore
No, if it were so, then the SELL would also be trawled incorrectly, while the SELL works fine...... I already tried changing the initial value of priceBUY from "0" to "open price".... does not work, my brain is already fried(((
No, if it were, SELL wouldn't work correctly either, but SELL works fine...... I already tried changing initial value of priceBUY from "0" to "open price" .... does not work, my brain is already fried(((
What's stopping you from using code like this?
extern int ts=25, minp=10;
for(int i = OrdersTotal(); i >= 0; i--)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
// check for symbol & magic numberif(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
if(OrderType() == OP_BUY) // long position is opened
{
if((Bid-OrderOpenPrice())>Point*(ts+minp)) // trall
{
if(OrderStopLoss()<Bid-Point*ts)
{
if(!OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid-Point*ts,Digits),0,0,Orange)) {Sleep(11000); prevtime = Time[1];}
}
}
}
if(OrderType() == OP_SELL) // short position is opened
{
if((OrderOpenPrice()-Ask)>Point*(ts+minp))// trall
{
if(OrderStopLoss()>Ask+Point*ts)
{
if(!OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Ask+Point*ts,Digits),0,0,Orange))
{
Sleep(11000);
prevtime = Time[1];
}
}
}
}
}
}
//----
If there is only one order in the example (either BUY or SELL), but if there are more orders, then I need all orders to be trailed from the level of total breakeven. And it is important for me to understand what is the reason in this code, because the SELL order is executed excellently, what is missing for BAY? Why does it modify the stop immediately after opening......!?
In this example I only have one order (either BUY or SELL), but if there is more than one, I want all orders to be taken from Breakeven. And it is important for me to understand what is the reason in this code, because SELL order is executed in a good way, what is missing for BAY? Why does it modify the stop immediately after opening......!?
3) set a trap if the compared price is equal to zero.
Thanks for your help, thanks to everyone who responded...... It worked, I swapped the "Breakeven Level Calculation" with the "Position Opening" block and everything worked as it should...... Thanks again everyone)))) And I'm going to hang myself)
Can you tell me if there is something in the code MTFindyuka make that it automatically computed and redid the history, ideally every minute that would not turn out here is such krakozobraha
In the picture there are two МТФinduks for 5 min, on the one-minute chart.
I've got to get normal view, i.e. smooth steps, to choose properties of the indicator and press "OK" or "refresh graphic".If I use m1 and MTF5m I'm tired to refresh it manually sometimes, maybe I can simply implement it by attaching some smart function, I don't want to write a separate code for each indicator.
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.
No, if it were so, then the SELL would also be trawled incorrectly, while the SELL works fine...... I already tried changing the initial value of priceBUY from "0" to "open price".... does not work, my brain is already fried(((
No, if it were, SELL wouldn't work correctly either, but SELL works fine...... I already tried changing initial value of priceBUY from "0" to "open price" .... does not work, my brain is already fried(((
What's stopping you from using code like this?
Everything works as it should.
Happy St Patrick's Day everyone!
Dear, I'm asking for help. Help me to get a signal out of an indicator into an EA. I.e. if a blue line appears - buy, if red - sell.
Wrote so in owl:
I have not got anything, it seems buffers are always equal to 0.
evillive А что мешает использавать вот такой код?
If there is only one order in the example (either BUY or SELL), but if there are more orders, then I need all orders to be trailed from the level of total breakeven. And it is important for me to understand what is the reason in this code, because the SELL order is executed excellently, what is missing for BAY? Why does it modify the stop immediately after opening......!?
In this example I only have one order (either BUY or SELL), but if there is more than one, I want all orders to be taken from Breakeven. And it is important for me to understand what is the reason in this code, because SELL order is executed in a good way, what is missing for BAY? Why does it modify the stop immediately after opening......!?Because the price being compared is not :
1) initialised
2) equal to zero
Actions:
1) uninitialise and see,
2) initialize with a large number
3) trap if compared price is equal to zero
Happy St Patrick's Day everyone!
Dear, I'm asking for help. Help me to get a signal out of an indicator into an EA. I.e. if a blue line appears - buy, if red - sell.
Wrote so in owl:
I have not got anything, it seems buffers are always equal to 0.
And why are you comparing with EMPTY_VALUE. You are comparing with 0.0
1) инициализирована
2) is equal to zero.
Actions:
1) unprinter and see,
2) initialize with a large number
3) set a trap if the compared price is equal to zero.
And why are you comparing with EMPTY_VALUE. You are comparing with 0.0.
I tried it this way too:
Still no response.
Can you tell me if there is something in the code MTFindyuka make that it automatically computed and redid the history, ideally every minute that would not turn out here is such krakozobraha
In the picture there are two МТФinduks for 5 min, on the one-minute chart.
ExtMapBuffer1[i]=iCustom(Symbol(),TimeFrame, "T-Line alert10",0,y);
ExtMapBuffer2[i]=iCustom(Symbol(),TimeFrame, "T-Line alert10",1,y);
I've got to get normal view, i.e. smooth steps, to choose properties of the indicator and press "OK" or "refresh graphic".If I use m1 and MTF5m I'm tired to refresh it manually sometimes, maybe I can simply implement it by attaching some smart function, I don't want to write a separate code for each indicator.