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
For a cake and a cup of coffee, a warning should be tweaked ( from the new builds of mt4)
)
Well, the pie can be mailed... Where do you get the coffee?
Well, you can mail a pie... Where do you get the coffee?
Thank you.)))
corrected code returned to the article thread.................................................
I am trying to install MetaTrader4 from original installation file mt4setup.exe but MT5 is installed to me brazenly. Windows7 x64 system. Is this how the developer is trying to get me to like the new platform? How can I install what I want (MT4) and not what is foisted on me?
I am trying to implement the stop loss and take profit in this way:
spread = Ask-Bid;
double StopLoss_B = NormalizeDouble(Low[1]- spread,Digits);//NormalizeDouble(Low[1]- spread,Digits)
double TakeProfit_B = NormalizeDouble(Ask+((Ask-StopLoss_B)* RiskRewart),Digits) ;
double StopLoss_S = NormalizeDouble(High[1]+ spread,Digits);//NormalizeDouble(High[1]+ spread,Digits)
double TakeProfit_S = NormalizeDouble(Bid-((StopLoss_S-Bid)* RiskRewart),Digits) ;
....
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,StopLoss_B,TakeProfit_B, "PBar",Magik,0,Blue);
....
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,StopLoss_S,TakeProfit_S, "PBar",Magik,0,Red);
The tester shows error 130 - something wrong with TP and SL. I cannot understand what exactly, especially since sometimes it runs fine, and sometimes I get an error.
In general, please help.
I am trying to implement the stop loss and take profit in this way:
spread = Ask-Bid;
double StopLoss_B = NormalizeDouble(Low[1]- spread,Digits);//NormalizeDouble(Low[1]- spread,Digits)
double TakeProfit_B = NormalizeDouble(Ask+((Ask-StopLoss_B)* RiskRewart),Digits) ;
double StopLoss_S = NormalizeDouble(High[1]+ spread,Digits);//NormalizeDouble(High[1]+ spread,Digits)
double TakeProfit_S = NormalizeDouble(Bid-((StopLoss_S-Bid)* RiskRewart),Digits) ;
....
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,StopLoss_B,TakeProfit_B, "PBar",Magik,0,Blue);
....
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,StopLoss_S,TakeProfit_S, "PBar",Magik,0,Red);
The tester shows error 130 - something wrong with TP and SL. I cannot understand what exactly, especially since sometimes it runs fine, and sometimes I get an error.
In general, please help.
Maybe sometimes you set too close to the current price, see what the function returns
...
Forum on Trading, Automated Trading Systems and Strategy Tests
Questions from Beginners MQL4 MT4 MetaTrader 4
Sergey Gritsay, 2017.01.07 18:48
Maybe sometimes you bet too close to the current price, see what the function returns to you
...
Thank you for your participation. Didn't figure out how to use the suggested function. But you have encouraged me to learn more about those errors on the chart and understood that the reason is that when a Stop Loss is triggered, but the candle has not closed yet, the EA tries to place a new order, and that is where the error occurs. I have to think how to explain the EA that only one order per candle is needed
Thank you for your participation. I haven't figured out how to use the suggested function. But you have encouraged me to learn more about those errors on the chart and understood that the reason is that when a Stop Loss is triggered but the candle has not yet closed the EA tries to place a new order, that is where the error occurs. I have to think how to explain the EA that only one order per candle is needed
Forum on Trading, Automated Trading Systems and Strategy Tests
Questions from beginners MQL4 MT4 MetaTrader 4
Vitalie Postolache, 2017.01.07 21:23
Watch among the closed orders, if the Expert Advisor has an order on the given symbol, watch the difference(time of closing of the order) -(time of opening of the candle), if the difference is less than PeriodSeconds() - do not open a new order.Did things a little differently.
New bar function:
bool NewBar()
{
static datetime lastbar = 0;
datetime curbar = Time[0];
if(lastbar != curbar)
{
lastbar = curbar;
return (true);
}
else return(false);
}
and I wrote conditions for opening only if there is a new bar