//+------------------------------------------------------------------+ // Is New Bar…
- User
//+------------------------------------------------------------------+ //| Is New Bar Function | //+------------------------------------------------------------------+ bool IsNewBar() { static datetime previousTime = 0; datetime currentTime = iTime(_Symbol, Timeframe, 0); if (previousTime != currentTime) { previousTime = currentTime; return true; } return false; }
//+------------------------------------------------------------------+ //| Trailing Stop | //+------------------------------------------------------------------+ void TrailStop() { double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK); double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
codefor (int i = PositionsTotal() - 1; i >= 0; i--) { if (pos.SelectByIndex(i) && pos.Magic() == InpMagic && pos.Symbol() == _Symbol) { double sl = 0; double tp = pos.TakeProfit(); if (pos.PositionType() == POSITION_TYPE_BUY) { if (bid - pos.PriceOpen() >= TslTriggerPoints * _Point) { sl = bid - TslPoints * _Point; if (sl > pos.StopLoss() || pos.StopLoss() == 0) trade.PositionModify(pos.Ticket(), sl, tp); } } if (pos.PositionType() == POSITION_TYPE_SELL) { if (pos.PriceOpen() - ask >= TslTriggerPoints * _Point) { sl = ask + TslPoints * _Point; if (sl < pos.StopLoss() || pos.StopLoss() == 0) trade.PositionModify(pos.Ticket(), sl, tp); } } } }}
//+------------------------------------------------------------------+ //| High and Low Search | //+------------------------------------------------------------------+ double findHigh() { double highestHigh = 0; for (int i = 0; i < 200; i++) { double high = iHigh(_Symbol, Timeframe, i); if (i > BarsN && iHighest(_Symbol, Timeframe, MODE_HIGH, BarsN * 2 + 1, i - BarsN) == i) { if (high > highestHigh) return high; } highestHigh = MathMax(high, highestHigh); } return -1; }
- Assistant
- User
me entregue o codigo completo
- Assistant
- User
'PositionSelectByIndex' - undeclared identifier Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 44 19 'i' - some operator expected Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 44 41 'ORDER_BUY_STOP' - undeclared identifier Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 129 25 'ORDER_SELL_STOP' - undeclared identifier Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 138 25 'SELECT_BY_POS' - undeclared identifier Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 155 28 'MODE_TRADES' - undeclared identifier Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 155 43 'OrderSelect' - wrong parameters count Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 155 13 built-in: bool OrderSelect(ulong) Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 155 13 'OrderSymbol' - undeclared identifier Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 157 17 ')' - expression expected Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 157 29 implicit conversion from 'unknown' to 'string' Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 157 17 'OrderMagicNumber' - undeclared identifier Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 158 17 ')' - expression expected Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 158 34 'OrderType' - undeclared identifier Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 159 17 ')' - expression expected Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 159 27 'OrderOpenPrice' - undeclared identifier Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 160 25 ')' - expression expected Scalping_GOLD__008_NEURAL_Buy_Sell_.mq5 160 40
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.