Error while compiling
//+------------------------------------------------------------------+
//| CW 1.001 |
//| Owner: Ajayi Emmanuel |
//| Email: ajayronny2016@gmail.com|
//+------------------------------------------------------------------+
#property copyright "Ajayi Emmanuel"
#property version "1.001"
#property script_show_inputs
input int lotSize = 0; // Set to 0 for minimal lot size
input int positions = 3;
// Buy condition
bool BuyCondition() {
return (iCCI(_Symbol, _Period, 20, PRICE_CLOSE, 0) > 100 && iWPR(_Symbol, _Period, 14, 0) > -20);
}
// Sell condition
bool SellCondition() {
return (iCCI(_Symbol, _Period, 20, PRICE_CLOSE, 0) < -100 && iWPR(_Symbol, _Period, 14, 0) < -80);
}
// Entry function
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[]) {
int positionsOpened = 0;
for (int i = positions - 1; i >= 0; --i) {
if (BuyCondition()) {
OrderSend(_Symbol, OP_BUY, lotSize, Ask, 3, Ask - (2 * ATR(_Symbol, _Period, 14, 0)), Ask + (2 * ATR(_Symbol, _Period, 14, 0)), "Buy Order", 0, 0, Green);
positionsOpened++;
}
else if (SellCondition()) {
OrderSend(_Symbol, OP_SELL, lotSize, Bid, 3, Bid + (2 * ATR(_Symbol, _Period, 14, 0)), Bid - (2 * ATR(_Symbol, _Period, 14, 0)), "Sell Order", 0, 0, Red);
positionsOpened++;
}
}
// Check for exit conditions
if (positionsOpened > 0 && (iCCI(_Symbol, _Period, 20, PRICE_CLOSE, 0) < 100 && iWPR(_Symbol, _Period, 14, 0) < -20) ||
(iCCI(_Symbol, _Period, 20, PRICE_CLOSE, 0) > -100 && iWPR(_Symbol, _Period, 14, 0) > -80)) {
for (int i = 0; i < positionsOpened; ++i) {
OrderClose(OrderGetTicket(), OrderLots(), OrderClosePrice(), 3, Yellow);
}
}
return (positionsOpened > 0) ? rates_total : 0;
}
That is me trying what I know and learnt in mql5 but have been having issues with any code I made..... I will check yours and try it, I later saw it. Thanks alot