kesa:
remove one open curly bracket after void OnTick()
Hello,Guys,
I just started coding on MT5 platform few days ago, so I am very new in this. However, I was trying to build Partial close EA, but I constantly getting two errors: '}' - unexpected end of program ; '{' - unbalanced parentheses. I checked the code many times but I can't find where is the mistake if I try to balanced parentheses then I am getting like 32 more errors... I can't find where is a problem. Can someone help me please? :) I will add my code so you can understand better that I am talking about. Thank you :)
thank you for your quick reply. I tried to delete one after //open buy market order. It looks like that now but I am getting 32 errors now instead of 2... What do you think what else it could be because I am running out of options... :)
void OnTick() { //Open buy market order glBuyPlaced=Trade.Buy(_Symbol,TradeVolume); //Modify SL/TP if(glBuyPlaced==true) { do Sleep(100); while(PositionSelect(_Symbol)==false); double positionOpenPrice=PositionOpenPrice(); double buyStopLoss=BuyStopLoss(_Symbol,StopLoss,positionOpenPrice); if(buyStopLoss>0) buyStopLoss=AdjustBelowStopLevel(_Symbol,buyStopLoss); double buyTakeProfit=BuyTakeProfit(_Symbol,TakeProfit2,positionOpenPrice); if(buyTakeProfit>0) buyTakeProfit=AdjustAboveStopLevel(_Symbol,buyTakeProfit); if(buyStopLoss>0 || buyTakeProfit>0) Trade.ModifyPosition(_Symbol,buyStopLoss,buyTakeProfit); glSellPlaced=false; } //Open partial close order double partialClose=positionOpenPrice+(TakeProfit1*_Point); double partialVolume=TradeVolume/2; Trade.SellLimit(_Symbol,partialVolume,partialClose); } //--- OnTick function end
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hello,Guys,
I just started coding on MT5 platform few days ago, so I am very new in this. However, I was trying to build Partial close EA, but I constantly getting two errors: '}' - unexpected end of program ; '{' - unbalanced parentheses. I checked the code many times but I can't find where is the mistake if I try to balanced parentheses then I am getting like 32 more errors... I can't find where is a problem. Can someone help me please? :) I will add my code so you can understand better that I am talking about. Thank you :)