NO . . . you NEED to learn . . . make some effort yourself for a change, read the book ( https://book.mql4.com// ) read the Documentation ( https://docs.mql4.com// ) . . . having different Magic numbers for long and sort trades is idiotic and NOT necessary . . .
if ( ( (LastOpenPrice(OP_SELL)+0.0030)<MarketInfo("EURUSD",MODE_BID) )&&( LastOpenPrice(OP_SELL)>0) ) <--------------- 0+0.0030=0.0030<Bid: TRUE // i think it will work { BUY("EURUSD",B_EURUSD_LS_1,B_EURUSD_TP_1,B_EURUSD_SL_1,B_EURUSD_TS_1,"if (
if ( ( (LastOpenPrice(OP_SELL)+0.0030)<MarketInfo("EURUSD",MODE_BID) )&&( LastOpenPrice(OP_SELL)>0) ) <--------------- 0+0.0030=0.0030<Bid: TRUE // i think it will work { BUY("EURUSD",B_EURUSD_LS_1,B_EURUSD_TP_1,B_EURUSD_SL_1,B_EURUSD_TS_1,"if (
when I ask "what is your game plan?" I really mean it. To re-phrase, what is your STRATEGY?
If you do NOT want to TRADE when there is no last open price, can you consider as such?
if(LastOpenPrice(OP_SELL) <=0) { return? do what? -----case of selling
if(LastOpenPrice(OP_BUY) <=0) { return?...or do what? ------ case for buying
then, the rest of the code proceeds....
with such an error as this one, I am afraid you can't "fill the holes" here and there in your codes. Your strategy looks ruined.
This sort of error "informs" you need to revise strategy at a higher level ---> WHEN to trade (and when not to). Do you have answers, ideas, etc, to that?
I completely forgotten to mention about this but this the most important for the entirety, and eternity of things, related. It's just total madness that YOU bonk the thought to see MY=YOUR solution, for which I don't.
Where on planet earth, are you at? who do you think I am? Your guardian angel, shaman, personal genie, etc?
Whatever you come to put into your head, I really can't help, just for your info.
I can help with the first one, maybe others can come in for the rest.
<-------------------- can consider to use if(OrdersTotal()>0..then proceed ---------------->double lastOpenedOpenPriceBuy() <----- what a name...confusing, maybe.
{
double ret = 0;
datetime time=0; <---- can consider setting Lowest Limit to -9999, at least -1, rather than 0. for(int i=0; i<OrdersTotal(); i++) { <----- do consider counting down.OrderSelect(i, SELECT_BY_POS, MODE_TRADES); <------ This returns some BOOLEAN result.then what?-----(?)if(OrderType()==OP_BUY && OrderOpenTime()>time) { <------ This can return runtime OrderSelect ERR bec. of above line (?). ------ (!)
time = OrderOpenTime();
ret = OrderOpenPrice();
}
}
return(ret);<------ return double as UnNormalized price. you sure about this?
}
<-------------------- can consider to use if(OrdersTotal()>0..then proceed ---------------->double lastOpenedOpenPriceBuy() <----- what a name...confusing, maybe.
{double ret = 0;
datetime time=0; <---- can consider setting Lowest Limit to -9999, at least -1, rather than 0. No order open time could <= 0for(int i=0; i<OrdersTotal(); i++) { <----- do consider counting down. Nothing different.OrderSelect(i, SELECT_BY_POS, MODE_TRADES); <------ This returns some BOOLEAN result.then what?-----(?) If in the loop, the order must exist, when the order exist, the OrderSelect won't cause error. If not in the loop, this line won't be executed.if(OrderType()==OP_BUY && OrderOpenTime()>time) { <------ This can return runtime OrderSelect ERR bec. of above line (?). ------ (!) Same reason as last line.
time = OrderOpenTime();
ret = OrderOpenPrice
();
}
}
return(ret);<------ return double as UnNormalized price. you sure about this? Already define ret = 0 at the first line.
}
Boy oh boy, you're simply amazing. Thks for pointing those out esp, this:
OrderSelect(i, SELECT_BY_POS, MODE_TRADES); <------If in the loop, the order must exist, when the order exist, the OrderSelect won't cause error. If not in the loop, this line won't be executed.
I reckon this line of yours has some Houdini powers to vanish out of the loop when no orders, re-appearing when there are.
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.
You mean:
Please i need to see your sulotionPlease i need to see your sulotion
maybe by this way it will work .
if ( ( (LastOpenPrice(OP_SELL)+0.0030)<MarketInfo("EURUSD",MODE_BID) )&&( LastOpenPrice(OP_SELL)>0) ) <--------------- 0+0.0030=0.0030<Bid: TRUE // i think it will work
{ BUY("EURUSD",B_EURUSD_LS_1,B_EURUSD_TP_1,B_EURUSD_SL_1,B_EURUSD_TS_1,"if (
maybe by this way it will work .
if ( ( (LastOpenPrice(OP_SELL)+0.0030)<MarketInfo("EURUSD",MODE_BID) )&&( LastOpenPrice(OP_SELL)>0) ) <--------------- 0+0.0030=0.0030<Bid: TRUE // i think it will work
{ BUY("EURUSD",B_EURUSD_LS_1,B_EURUSD_TP_1,B_EURUSD_SL_1,B_EURUSD_TS_1,"if (
when I ask "what is your game plan?" I really mean it. To re-phrase, what is your STRATEGY?
If you do NOT want to TRADE when there is no last open price, can you consider as such?
if(LastOpenPrice(OP_SELL) <=0) { return? do what? -----case of selling
if(LastOpenPrice(OP_BUY) <=0) { return?...or do what? ------ case for buying
then, the rest of the code proceeds....
with such an error as this one, I am afraid you can't "fill the holes" here and there in your codes. Your strategy looks ruined.
This sort of error "informs" you need to revise strategy at a higher level ---> WHEN to trade (and when not to). Do you have answers, ideas, etc, to that?
You mean:
Please i need to see your sulotionI completely forgotten to mention about this but this the most important for the entirety, and eternity of things, related. It's just total madness that YOU bonk the thought to see MY=YOUR solution, for which I don't.
Where on planet earth, are you at? who do you think I am? Your guardian angel, shaman, personal genie, etc?
Whatever you come to put into your head, I really can't help, just for your info.
guys,
Please check the below functions (if correct or not) i need to do this conditions
if ( lastOpenedOpenPriceBuy()-lastOpenedOpenPriceSell() )>=0.0060
{ do something }
I can help with the first one, maybe others can come in for the rest.
Please note that:
when i put this condiction
it doen not work,but when i added one more condiction
it looks like fine (lastOpenedOpenPriceBuy()>0)Boy oh boy, you're simply amazing. Thks for pointing those out esp, this: