You are very sloppy in writing programs. You have lost a LOT of characters ')'
Vladimir Karputov:
You are very sloppy in writing programs. You have lost a LOT of characters ')'
You are very sloppy in writing programs. You have lost a LOT of characters ')'
Valter Zuccoli :
Already corrected that. But still doesn't works.
Already corrected that. But still doesn't works.
Unfortunately, I cannot get into your brain and I cannot see your new code - so I ask you: show the code that you worked on and in which you fixed the errors.
//+------------------------------------------------------------------+ //| ProjectName | //| Copyright 2020, CompanyName | //| http://www.companyname.net | //+------------------------------------------------------------------+ #property copyright "2009-2017, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property description "1.00" #include <Trade\Trade.mqh> CTrade trade; int handle; double linha_macd[]; double linha_signal[]; MqlRates rates []; input double _volume = 2.0; //Quantidade de Lotes: input double meuStop = 150.0; //Stop Loss (pontos): input double meuTake = 50.0; //Take Profit (pontos): //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnInit() { ArraySetAsSeries(rates, true); ArraySetAsSeries(linha_macd, true); ArraySetAsSeries(linha_signal, true); handle = iMACD(Symbol(), PERIOD_CURRENT, 12,26,9, PRICE_CLOSE); return (INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnTick() { CopyRates(Symbol(), PERIOD_CURRENT, 0, 3, rates); CopyBuffer(handle, 0, 0, 3, linha_macd); CopyBuffer(handle, 1, 0, 3, linha_signal); if(linha_macd[2] < linha_signal[2] && linha_macd[1] > linha_signal[1] && linha_macd[0] < 0 && linha_signal[0] < 0) { //ObjectCreate(0, rates[1].time, OBJ_ARROW_BUY, 0, rates[1].time, rates[1].low); if(PositionsTotal() == 0) { if(trade.Buy(_volume, Symbol(),0,0,0, "Compra") { addTakeStop(meuStop, meuTake); } } if(linha_macd[2] > linha_signal[2] && linha_macd[1] < linha_signal[1] && linha_macd[0] > 0 && linha_signal[0] > 0) { //ObjectCreate(0, rates[1].time, OBJ_ARROW_SELL, 0, rates[1].time, rates[1].high); if(PositionsTotal() == 0) { if(trade.Sell(_volume, Symbol(),0,0,0, "Venda") { addTakeStop(meuStop, meuTake); } } } } void addTakeStop(double p_sl, double p_tp) { for(int i = PositionsTotal() -1; i>=0; i--) { string symbol = PositionGetSymbol(i); if(symbol == Symbol() { ulong ticket = PositionGetInteger(POSITION_TICKET); double precoEntrada = PositionGetDouble(POSITION_PRICE_OPEN); double novoSL; double novoTP; if(PositionsGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY) { novoSL = NormalizeDouble(precoEntrada - (p_sl *_Point), _Digits); novoTP = NormalizeDouble(precoEntrada + (p_tp *_Point), _Digits); trade.PositionModify(ticket, novoSL, novoTP); } else if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL) { novoSL = NormalizeDouble(precoEntrada + (p_sl *_Point), _Digits); novoTP = NormalizeDouble(precoEntrada - (p_tp *_Point), _Digits); trade.PositionModify(ticket, novoSL, novoTP); } } } } //+------------------------------------------------------------------+
You haven't done anything.
Please follow all signs ')' - You have lost a few characters ')'
Vladimir Karputov:
You haven't done anything.
Please follow all signs ')' - You have lost a few characters ')'
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
After compiling I get the 2 erros: "Unexpected end of program" and "Unbalanced parentheses"
Can someone help ?