Help! :) Why is this not compiling?
Oh no, it's a new coder... :D
Embed your robot in the post using code tags, see the </> icon in the editor panel.
Oh no, it's a new coder... :D
Embed your robot in the post using code tags, see the </> icon in the editor panel.
ha yeah I'm sure you get 100s like me
int Trade = GetTotalOpenTrades(); Print("*** Our Total number of Trades: ", Trades);
int Trades = GetTotalOpenTrades(); Print("*** Our Total number of Trades: ", Trades);
if ( GetTotalOpenTrades() < MaxTrade )
if ( GetTotalOpenTrades() < MaxTrades )
int TotolTrades = 0; // // TotolTrades = (TotalTrades +1);
int TotalTrades = 0; // // TotalTrades = (TotalTrades +1);
Make sure that you use the correct variable name after you have declared them
OK done..
#property strict string BotName = "JHB Robot"; int Magic = 1234; int MaxTrades = 1; double LotsToTrade = 2.0; double StopLoss = 3700; double ProfitTarget = 280.00; int OnInit() { return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { } // This runs on every single tick void OnTick() { double SlowMovingAverage = iMA(NULL, 0, 250, 0, MODE_SMA, PRICE_CLOSE, 0); double FastMovingAverage = iMA(NULL, 0, 145, 0, MODE_SMA, PRICE_CLOSE, 0); //Print("***** Slow Moving Average: ", SlowMovingAverage); int Trades = GetTotalOpenTrades(); Print("*** Our Total number of Trades: ", Trades); if ( GetTotalOpenTrades() < MaxTrades ) { // do nothing } } int GetTotalOpenTrades() { int TotolTrades = 0; // Loop through open orders and add them to TotalTrades for (int t=0; t<OrdersTotal(); t++) { if(OrderSelect(t, SELECT_BY_POS, MODE_TRADES)) { if(OrderSymbol() != Symbol()) continue; if(OrderMagicNumber() != Magic) continue; if(OrderCloseTime() != 0) continue; TotolTrades = (TotalTrades +1); } } return TotalTrades; }
I made some fixes and now I get less errors but I still
see error report for
line 60 and 65
You need to be precise on the variable names as Keith said. Replace 'TotolTrades' with 'TotalTrades' and give it a go.
int TotalTrades = 0;
TotalTrades = (TotalTrades +1);

Hi all,
New coder here
I thought I had everything right but obviously not as it's not compiling.
If anyone can find the error I would love it.
Thanks.
The file is attached as well...