banner_forum
Devenez membre de la plus grande
communauté francophone sur le Forex
Partagez, échangez et apprenez en gagnant des crédits sur votre compte de trading

EA à partager et améliorer sur indicateur 3 LEVEL ZZ

  • thierry8310

    bonjour a tous et toutes
    je voudrais partager un ea avec vous pour en plus le développer et l améliorer
    après des jours a trader en manuel les résultats sont assez probant
    mais je n ai ni le temps et surtout pas l envie de passer mes journees devant un pc
    du coup j ai par l intermédiaire de EABUILDER crée n EA basé sur l indicateur 3_Level_ZZ_Semafor.mq4
    le principe est d acheter quand le trois apparaît mais ce avec un rsi inférieur a 30
    possibilité d ouvrir plusieurs positions ( paramétrable )
    et bien sur vente dans le sens contraire
    petit soucis j ai toujours et encore la même phrase qui reviens
    "" 2018.07.24 12:39:29.019 cannot open file 'C:\Users\Administrator\AppData\Roaming\MetaQuotes\Terminal\61007F75C6EC7CED9A269B292061D7A1\MQL4\indicators\3-level-zz-semafor.ex4' [2]
    j ai changé le nom de l indicateur de l EA c est toujours pareil
    si quelqu un a une idée et as envie d affiner les réglages
    je vous met en piece jointe l EA et l indicateur


    merci
    thierry8310 a joint une image
    ea-as-partager-et-ameliorer-sur-indicateur-3-level-zz-10891
  • riden

    Salut,

    L'EA n'est pas en pièce jointe il n'y a que l'imprime-écran. Je peux débugger le code pour ça compile correctement et que les erreurs disparaissent.
    Je ne veux pas te décourager mais les conditions de prise de positions sont très basiques. Il te faut d'autres conditions pour minimiser la fréquence de signaux qui sera élevées et des filtres pour filtrer les faux signaux.
    Le rsi peut rester longtemps au-dessous de 30 et le 3 va repeindre et apparaître de nouveau sur chaque nouveau plus bas et tu auras un nouveau signal d'achat à chaque fois.
    Il faut aussi déterminer manuellement ou à travers les backtest les paires et les TF sur lesquelles le EA donne les meilleurs résultats et les paires et TF qu'il faut éviter.
    Il faut aussi déterminer les pts de sortie (SL&TP) optimaux.
    Exemple parmi les conditions: ajouter une mm longue pour ne pas trader contre tendance / un nuage ichimoku peut être
    Exemple parmi les filtres: ne pas acheter que si une divergence haussière est détectée(tu peux te baser sur le 3 et la vague du bas qui le précède avec le rsi pour détecter les divergences) et vise-versa pour la vente.
    Exemple basique pour les pts de sortie: TP avant le prochain pt pivot et SL après le pt pivot si par exemple |pt d'entrée-TP|>=|pt d'entrée-SL|

    Voilà quelques idées mais ça reste à toi d'optimiser ton EA.
  • kaliloup

    Bonjour, essai d'enlever le .ex4 (si tu l'as renseigné) du nom de ton indicateur dans iCustom(NULL,0," 3_Level_ZZ_Semafor",........); et assure toi que le nom de ton indicateur soit exactement le même.
  • thierry8310 — en réponse à kaliloup dans son message #111584

    merci a toi KALILOUP
    mais j ai deja essaye aussi
    mais je vais qd meme le reverifier
    merci
  • thierry8310 — en réponse à riden dans son message #111583

    merci riden
    j ai rajouter ea en pièce jointe
    et on en reparle lol
    mais ton idée d une mm pas mal
  • riden

    Essayes de copier-coller le code si joindre les fichiers n'est pas permis. (Je ne serais disponible que demain ou tard le soir)
  • thierry8310 — en réponse à riden dans son message #111588

    salut riden tu a eu l Ea et l indicateur en fichier joint ?
  • riden

    Non il n'y a rien en pièce jointe.
    j'ai déjà l'indicateur. Pour le EA envois-moi son code dans ton prochain poste comme je te l'ai demandé avant.

    riden, le 24/07/2018 dit :
    Essayes de copier-coller le code si joindre les fichiers n'est pas permis. (Je ne serais disponible que demain ou tard le soir)
  • thierry8310 — en réponse à riden dans son message #111595

    //+------------------------------------------------------------------+
    //| Strategy: LEVEL2.mq4 |
    //| Created with EABuilder.com |
    //| http://eabuilder.com |
    //+------------------------------------------------------------------+
    #property copyright "Created with EABuilder.com"
    #property link "http://eabuilder.com"
    #property version "1.00"
    #property description ""

    #include <stdlib.mqh>
    #include <stderror.mqh>

    int LotDigits; //initialized in OnInit
    extern int MagicNumber = 1332102;
    extern int NextOpenTradeAfterBars = 8; //next open trade after time
    datetime LastTradeTime = 0;
    extern double TradeSize = 1;
    extern int MaxSlippage = 3; //adjusted in OnInit
    extern int MaxOpenTrades = 7;
    int MaxLongTrades = 1000;
    int MaxShortTrades = 1000;
    int MaxPendingOrders = 1000;
    bool Hedging = false;
    int OrderRetry = 5; //# of retries if sending order returns error
    int OrderWait = 5; //# of seconds to wait if sending order returns error
    double myPoint; //initialized in OnInit

    void myAlert(string type, string message)
    {
    if(type == "print";)
    Print(message);
    else if(type == "error";)
    {
    Print(type+" | LEVEL2 @ "+Symbol()+","+Period()+" | "+message);
    }
    else if(type == "order";)
    {
    }
    else if(type == "modify";)
    {
    }
    }

    int TradesCount(int type) //returns # of open trades for order type, current symbol and magic number
    {
    int result = 0;
    int total = OrdersTotal();
    for(int i = 0; i < total; i++)
    {
    if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == false) continue;
    if(OrderMagicNumber() != MagicNumber || OrderSymbol() != Symbol() || OrderType() != type) continue;
    result++;
    }
    return(result);
    }

    int myOrderSend(int type, double price, double volume, string ordername) //send order, return ticket ("price" is irrelevant for market orders)
    {
    if(!IsTradeAllowed()) return(-1);
    int ticket = -1;
    int retries = 0;
    int err;
    int long_trades = TradesCount(OP_BUY);
    int short_trades = TradesCount(OP_SELL);
    int long_pending = TradesCount(OP_BUYLIMIT) + TradesCount(OP_BUYSTOP);
    int short_pending = TradesCount(OP_SELLLIMIT) + TradesCount(OP_SELLSTOP);
    string ordername_ = ordername;
    if(ordername != "";)
    ordername_ = ":'("+ordername+";)";
    //test Hedging
    if(!Hedging && ((type % 2 == 0 && short_trades + short_pending > 0) || (type % 2 == 1 && long_trades + long_pending > 0)))
    {
    myAlert("print", "Order"+ordername_+" not sent, hedging not allowed";);
    return(-1);
    }
    //test maximum trades
    if((type % 2 == 0 && long_trades >= MaxLongTrades)
    || (type % 2 == 1 && short_trades >= MaxShortTrades)
    || (long_trades + short_trades >= MaxOpenTrades)
    || (type > 1 && long_pending + short_pending >= MaxPendingOrders))
    {
    myAlert("print", "Order"+ordername_+" not sent, maximum reached";);
    return(-1);
    }
    //prepare to send order
    while(IsTradeContextBusy()) Sleep(100);
    RefreshRates();
    if(type == OP_BUY)
    price = Ask;
    else if(type == OP_SELL)
    price = Bid;
    else if(price < 0) //invalid price for pending order
    {
    myAlert("order", "Order"+ordername_+" not sent, invalid price for pending order";);
    return(-1);
    }
    int clr = (type % 2 == 1) ? clrRed : clrBlue;
    while(ticket < 0 && retries < OrderRetry+1)
    {
    ticket = OrderSend(Symbol(), type, NormalizeDouble(volume, LotDigits), NormalizeDouble(price, Digits()), MaxSlippage, 0, 0, ordername, MagicNumber, 0, clr);
    if(ticket < 0)
    {
    err = GetLastError();
    myAlert("print", "OrderSend"+ordername_+" error #"+err+" "+ErrorDescription(err));
    Sleep(OrderWait*1000);
    }
    retries++;
    }
    if(ticket < 0)
    {
    myAlert("error", "OrderSend"+ordername_+" failed "+(OrderRetry+1)+" times; error #"+err+" "+ErrorDescription(err));
    return(-1);
    }
    string typestr[6] = {"Buy", "Sell", "Buy Limit", "Sell Limit", "Buy Stop", "Sell Stop"};
    myAlert("order", "Order sent"+ordername_+": "+typestr[type]+" "+Symbol()+" Magic #"+MagicNumber);
    return(ticket);
    }

    void myOrderClose(int type, int volumepercent, string ordername) //close open orders for current symbol, magic number and "type" (OP_BUY or OP_SELL)
    {
    if(!IsTradeAllowed()) return;
    if (type > 1)
    {
    myAlert("error", "Invalid type in myOrderClose";);
    return;
    }
    bool success = false;
    int err;
    string ordername_ = ordername;
    if(ordername != "";)
    ordername_ = ":'("+ordername+";)";
    int total = OrdersTotal();
    for(int i = total-1; i >= 0; i--)
    {
    while(IsTradeContextBusy()) Sleep(100);
    if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
    if(OrderMagicNumber() != MagicNumber || OrderSymbol() != Symbol() || OrderType() != type) continue;
    while(IsTradeContextBusy()) Sleep(100);
    RefreshRates();
    double price = (type == OP_SELL) ? Ask : Bid;
    double volume = NormalizeDouble(OrderLots()*volumepercent * 1.0 / 100, LotDigits);
    if (NormalizeDouble(volume, LotDigits) == 0) continue;
    success = OrderClose(OrderTicket(), volume, NormalizeDouble(price, Digits()), MaxSlippage, clrWhite);
    if(!success)
    {
    err = GetLastError();
    myAlert("error", "OrderClose"+ordername_+" failed; error #"+err+" "+ErrorDescription(err));
    }
    }
    string typestr[6] = {"Buy", "Sell", "Buy Limit", "Sell Limit", "Buy Stop", "Sell Stop"};
    if(success) myAlert("order", "Orders closed"+ordername_+": "+typestr[type]+" "+Symbol()+" Magic #"+MagicNumber);
    }

    //+------------------------------------------------------------------+
    //| Expert initialization function |
    //+------------------------------------------------------------------+
    int OnInit()
    {
    //initialize myPoint
    myPoint = Point();
    if(Digits() == 5 || Digits() == 3)
    {
    myPoint *= 10;
    MaxSlippage *= 10;
    }
    //initialize LotDigits
    double LotStep = MarketInfo(Symbol(), MODE_LOTSTEP);
    if(LotStep >= 1) LotDigits = 0;
    else if(LotStep >= 0.1) LotDigits = 1;
    else if(LotStep >= 0.01) LotDigits = 2;
    else LotDigits = 3;
    LastTradeTime = 0;
    return(INIT_SUCCEEDED);
    }

    //+------------------------------------------------------------------+
    //| Expert deinitialization function |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
    {
    }

    //+------------------------------------------------------------------+
    //| Expert tick function |
    //+------------------------------------------------------------------+
    void OnTick()
    {
    int ticket = -1;
    double price;


    //Close Long Positions
    if(iCustom(NULL, PERIOD_CURRENT, "3-level-zz-semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3-level-zz-semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != EMPTY_VALUE //3-level-zz-semafor is not equal to fixed value
    && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) >= 70 //Relative Strength Index >= fixed value
    )
    {
    if(IsTradeAllowed())
    myOrderClose(OP_BUY, 100, "";);
    else //not autotrading => only send alert
    myAlert("order", "";);
    }

    //Close Short Positions
    if(iCustom(NULL, PERIOD_CURRENT, "3-level-zz-semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3-level-zz-semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != EMPTY_VALUE //3-level-zz-semafor is not equal to fixed value
    && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) <= 30 //Relative Strength Index <= fixed value
    )
    {
    if(IsTradeAllowed())
    myOrderClose(OP_SELL, 100, "";);
    else //not autotrading => only send alert
    myAlert("order", "";);
    }

    //Open Buy Order
    if(iCustom(NULL, PERIOD_CURRENT, "3-level-zz-semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3-level-zz-semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != EMPTY_VALUE //3-level-zz-semafor is not equal to fixed value
    && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) <= 30 //Relative Strength Index <= fixed value
    )
    {
    RefreshRates();
    price = Ask;
    if(TimeCurrent() - LastTradeTime < NextOpenTradeAfterBars * PeriodSeconds()) return; //next open trade after time
    if(IsTradeAllowed())
    {
    ticket = myOrderSend(OP_BUY, price, TradeSize, "";);
    if(ticket <= 0) return;
    }
    else //not autotrading => only send alert
    myAlert("order", "";);
    LastTradeTime = TimeCurrent();
    }

    //Open Sell Order
    if(iCustom(NULL, PERIOD_CURRENT, "3-level-zz-semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3-level-zz-semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != EMPTY_VALUE //3-level-zz-semafor is not equal to fixed value
    && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) >= 70 //Relative Strength Index >= fixed value
    )
    {
    RefreshRates();
    price = Bid;
    if(TimeCurrent() - LastTradeTime < NextOpenTradeAfterBars * PeriodSeconds()) return; //next open trade after time
    if(IsTradeAllowed())
    {
    ticket = myOrderSend(OP_SELL, price, TradeSize, "";);
    if(ticket <= 0) return;
    }
    else //not autotrading => only send alert
    myAlert("order", "";);
    LastTradeTime = TimeCurrent();
    }
    }
    //+------------------------------------------------------------------+
  • thierry8310 — en réponse à riden dans son message #111595

    je pense que c est l indicateur qui déconne
    qd je veux changer le nom ca me dis qu il es protegé en ecriture
    j ai fait un autre EA avec l indicateur des fleches qui sont sur la copie d ecran
    les deux ensemble serrais pas mal
  • kaliloup

    Renomme ton indicateur comme ceci stp: 3_Level_ZZ_Semafor et test.

    //+------------------------------------------------------------------+
    //| Strategy: LEVEL2.mq4 |
    //| Created with EABuilder.com |
    //| http://eabuilder.com |
    //+------------------------------------------------------------------+
    #property copyright "Created with EABuilder.com"
    #property link "http://eabuilder.com"
    #property version "1.00"
    #property description ""

    #include <stdlib.mqh>
    #include <stderror.mqh>

    int LotDigits; //initialized in OnInit
    extern int MagicNumber = 1332102;
    extern int NextOpenTradeAfterBars = 8; //next open trade after time
    datetime LastTradeTime = 0;
    extern double TradeSize = 1;
    extern int MaxSlippage = 3; //adjusted in OnInit
    extern int MaxOpenTrades = 7;
    int MaxLongTrades = 1000;
    int MaxShortTrades = 1000;
    int MaxPendingOrders = 1000;
    bool Hedging = false;
    int OrderRetry = 5; //# of retries if sending order returns error
    int OrderWait = 5; //# of seconds to wait if sending order returns error
    double myPoint; //initialized in OnInit

    void myAlert(string type, string message)
    {
    if(type == "print";)
    Print(message);
    else if(type == "error";)
    {
    Print(type+" | LEVEL2 @ "+Symbol()+","+Period()+" | "+message);
    }
    else if(type == "order";)
    {
    }
    else if(type == "modify";)
    {
    }
    }

    int TradesCount(int type) //returns # of open trades for order type, current symbol and magic number
    {
    int result = 0;
    int total = OrdersTotal();
    for(int i = 0; i < total; i++)
    {
    if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == false) continue;
    if(OrderMagicNumber() != MagicNumber || OrderSymbol() != Symbol() || OrderType() != type) continue;
    result++;
    }
    return(result);
    }

    int myOrderSend(int type, double price, double volume, string ordername) //send order, return ticket ("price" is irrelevant for market orders)
    {
    if(!IsTradeAllowed()) return(-1);
    int ticket = -1;
    int retries = 0;
    int err;
    int long_trades = TradesCount(OP_BUY);
    int short_trades = TradesCount(OP_SELL);
    int long_pending = TradesCount(OP_BUYLIMIT) + TradesCount(OP_BUYSTOP);
    int short_pending = TradesCount(OP_SELLLIMIT) + TradesCount(OP_SELLSTOP);
    string ordername_ = ordername;
    if(ordername != "";)
    ordername_ = ":'("+ordername+";)";
    //test Hedging
    if(!Hedging && ((type % 2 == 0 && short_trades + short_pending > 0) || (type % 2 == 1 && long_trades + long_pending > 0)))
    {
    myAlert("print", "Order"+ordername_+" not sent, hedging not allowed";);
    return(-1);
    }
    //test maximum trades
    if((type % 2 == 0 && long_trades >= MaxLongTrades)
    || (type % 2 == 1 && short_trades >= MaxShortTrades)
    || (long_trades + short_trades >= MaxOpenTrades)
    || (type > 1 && long_pending + short_pending >= MaxPendingOrders))
    {
    myAlert("print", "Order"+ordername_+" not sent, maximum reached";);
    return(-1);
    }
    //prepare to send order
    while(IsTradeContextBusy()) Sleep(100);
    RefreshRates();
    if(type == OP_BUY)
    price = Ask;
    else if(type == OP_SELL)
    price = Bid;
    else if(price < 0) //invalid price for pending order
    {
    myAlert("order", "Order"+ordername_+" not sent, invalid price for pending order";);
    return(-1);
    }
    int clr = (type % 2 == 1) ? clrRed : clrBlue;
    while(ticket < 0 && retries < OrderRetry+1)
    {
    ticket = OrderSend(Symbol(), type, NormalizeDouble(volume, LotDigits), NormalizeDouble(price, Digits()), MaxSlippage, 0, 0, ordername, MagicNumber, 0, clr);
    if(ticket < 0)
    {
    err = GetLastError();
    myAlert("print", "OrderSend"+ordername_+" error #"+err+" "+ErrorDescription(err));
    Sleep(OrderWait*1000);
    }
    retries++;
    }
    if(ticket < 0)
    {
    myAlert("error", "OrderSend"+ordername_+" failed "+(OrderRetry+1)+" times; error #"+err+" "+ErrorDescription(err));
    return(-1);
    }
    string typestr[6] = {"Buy", "Sell", "Buy Limit", "Sell Limit", "Buy Stop", "Sell Stop"};
    myAlert("order", "Order sent"+ordername_+": "+typestr[type]+" "+Symbol()+" Magic #"+MagicNumber);
    return(ticket);
    }

    void myOrderClose(int type, int volumepercent, string ordername) //close open orders for current symbol, magic number and "type" (OP_BUY or OP_SELL)
    {
    if(!IsTradeAllowed()) return;
    if (type > 1)
    {
    myAlert("error", "Invalid type in myOrderClose";);
    return;
    }
    bool success = false;
    int err;
    string ordername_ = ordername;
    if(ordername != "";)
    ordername_ = ":'("+ordername+";)";
    int total = OrdersTotal();
    for(int i = total-1; i >= 0; i--)
    {
    while(IsTradeContextBusy()) Sleep(100);
    if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
    if(OrderMagicNumber() != MagicNumber || OrderSymbol() != Symbol() || OrderType() != type) continue;
    while(IsTradeContextBusy()) Sleep(100);
    RefreshRates();
    double price = (type == OP_SELL) ? Ask : Bid;
    double volume = NormalizeDouble(OrderLots()*volumepercent * 1.0 / 100, LotDigits);
    if (NormalizeDouble(volume, LotDigits) == 0) continue;
    success = OrderClose(OrderTicket(), volume, NormalizeDouble(price, Digits()), MaxSlippage, clrWhite);
    if(!success)
    {
    err = GetLastError();
    myAlert("error", "OrderClose"+ordername_+" failed; error #"+err+" "+ErrorDescription(err));
    }
    }
    string typestr[6] = {"Buy", "Sell", "Buy Limit", "Sell Limit", "Buy Stop", "Sell Stop"};
    if(success) myAlert("order", "Orders closed"+ordername_+": "+typestr[type]+" "+Symbol()+" Magic #"+MagicNumber);
    }

    //+------------------------------------------------------------------+
    //| Expert initialization function |
    //+------------------------------------------------------------------+
    int OnInit()
    {
    //initialize myPoint
    myPoint = Point();
    if(Digits() == 5 || Digits() == 3)
    {
    myPoint *= 10;
    MaxSlippage *= 10;
    }
    //initialize LotDigits
    double LotStep = MarketInfo(Symbol(), MODE_LOTSTEP);
    if(LotStep >= 1) LotDigits = 0;
    else if(LotStep >= 0.1) LotDigits = 1;
    else if(LotStep >= 0.01) LotDigits = 2;
    else LotDigits = 3;
    LastTradeTime = 0;
    return(INIT_SUCCEEDED);
    }

    //+------------------------------------------------------------------+
    //| Expert deinitialization function |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
    {
    }

    //+------------------------------------------------------------------+
    //| Expert tick function |
    //+------------------------------------------------------------------+
    void OnTick()
    {
    int ticket = -1;
    double price;


    //Close Long Positions
    if(iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != EMPTY_VALUE //3_Level_ZZ_Semafor is not equal to fixed value
    && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) >= 70 //Relative Strength Index >= fixed value
    )
    {
    if(IsTradeAllowed())
    myOrderClose(OP_BUY, 100, "";);
    else //not autotrading => only send alert
    myAlert("order", "";);
    }

    //Close Short Positions
    if(iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != EMPTY_VALUE //3_Level_ZZ_Semafor is not equal to fixed value
    && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) <= 30 //Relative Strength Index <= fixed value
    )
    {
    if(IsTradeAllowed())
    myOrderClose(OP_SELL, 100, "";);
    else //not autotrading => only send alert
    myAlert("order", "";);
    }

    //Open Buy Order
    if(iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != EMPTY_VALUE //3_Level_ZZ_Semafor is not equal to fixed value
    && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) <= 30 //Relative Strength Index <= fixed value
    )
    {
    RefreshRates();
    price = Ask;
    if(TimeCurrent() - LastTradeTime < NextOpenTradeAfterBars * PeriodSeconds()) return; //next open trade after time
    if(IsTradeAllowed())
    {
    ticket = myOrderSend(OP_BUY, price, TradeSize, "";);
    if(ticket <= 0) return;
    }
    else //not autotrading => only send alert
    myAlert("order", "";);
    LastTradeTime = TimeCurrent();
    }

    //Open Sell Order
    if(iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != EMPTY_VALUE //3_Level_ZZ_Semafor is not equal to fixed value
    && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) >= 70 //Relative Strength Index >= fixed value
    )
    {
    RefreshRates();
    price = Bid;
    if(TimeCurrent() - LastTradeTime < NextOpenTradeAfterBars * PeriodSeconds()) return; //next open trade after time
    if(IsTradeAllowed())
    {
    ticket = myOrderSend(OP_SELL, price, TradeSize, "";);
    if(ticket <= 0) return;
    }
    else //not autotrading => only send alert
    myAlert("order", "";);
    LastTradeTime = TimeCurrent();
    }
    }
    //+------------------------------------------------------------------+
  • thierry8310 — en réponse à kaliloup dans son message #111598

    salut kaliloup
    je teste mais il me semble que j ai deja essayé comme ca
    mais merci
  • thierry8310 — en réponse à thierry8310 dans son message #111599

    message 'fleche3.mq4' fleche3.mq4 1 1
    'stdlib.mqh' stdlib.mqh 1 1
    'stderror.mqh' stderror.mqh 1 1
    ';' - unexpected token fleche3.mq4 200 29
    ';' - unexpected token fleche3.mq4 200 29
    ';' - unexpected token fleche3.mq4 202 20
    ';' - unexpected token fleche3.mq4 202 20
    ';' - unexpected token fleche3.mq4 211 30
    ';' - unexpected token fleche3.mq4 211 30
    ';' - unexpected token fleche3.mq4 213 20
    ';' - unexpected token fleche3.mq4 213 20
    ';' - unexpected token fleche3.mq4 226 50
    ';' - unexpected token fleche3.mq4 226 50
    ';' - unexpected token fleche3.mq4 230 20
    ';' - unexpected token fleche3.mq4 230 20
    ';' - unexpected token fleche3.mq4 244 51
    ';' - unexpected token fleche3.mq4 244 51
    ';' - unexpected token fleche3.mq4 248 20
    ';' - unexpected token fleche3.mq4 248 20
    '(' - unbalanced left parenthesis fleche3.mq4 32 3
    empty controlled statement found fleche3.mq4 32 19
    ')' - unexpected token fleche3.mq4 32 20
    'else' - illegal 'else' without matching 'if' fleche3.mq4 34 1
    '(' - unbalanced left parenthesis fleche3.mq4 70 3
    empty controlled statement found fleche3.mq4 70 19
    ')' - unexpected token fleche3.mq4 70 20
    ';' - unexpected token fleche3.mq4 75 69
    ';' - unexpected token fleche3.mq4 75 69
    ';' - unexpected token fleche3.mq4 84 65
    ';' - unexpected token fleche3.mq4 84 65
    ';' - unexpected token fleche3.mq4 96 81
    ';' - unexpected token fleche3.mq4 96 81
    ';' - unexpected token fleche3.mq4 126 48
    ';' - unexpected token fleche3.mq4 126 48
    '(' - unbalanced left parenthesis fleche3.mq4 132 3
    empty controlled statement found fleche3.mq4 132 19
    ')' - unexpected token fleche3.mq4 132 20
    31 error(s), 3 warning(s) 32 4
    d erreur mdrrrr
  • kaliloup

    Sur MT4? Chez moi il compile et prend des ordres!
  • kaliloup

    //+------------------------------------------------------------------+
    //| Strategy: LEVEL2.mq4 |
    //| Created with EABuilder.com |
    //| http://eabuilder.com |
    //+------------------------------------------------------------------+
    #property copyright "Created with EABuilder.com"
    #property link "http://eabuilder.com"
    #property version "1.00"
    #property description ""

    #include <stdlib.mqh>
    #include <stderror.mqh>

    int LotDigits; //initialized in OnInit
    extern int MagicNumber = 1332102;
    extern int NextOpenTradeAfterBars = 8; //next open trade after time
    datetime LastTradeTime = 0;
    extern double TradeSize = 1;
    extern int MaxSlippage = 3; //adjusted in OnInit
    extern int MaxOpenTrades = 7;
    int MaxLongTrades = 1000;
    int MaxShortTrades = 1000;
    int MaxPendingOrders = 1000;
    bool Hedging = false;
    int OrderRetry = 5; //# of retries if sending order returns error
    int OrderWait = 5; //# of seconds to wait if sending order returns error
    double myPoint; //initialized in OnInit

    void myAlert(string type, string message)
    {
    if(type == "print";)
    Print(message);
    else if(type == "error";)
    {
    Print(type+" | LEVEL2 @ "+Symbol()+","+Period()+" | "+message);
    }
    else if(type == "order";)
    {
    }
    else if(type == "modify";)
    {
    }
    }

    int TradesCount(int type) //returns # of open trades for order type, current symbol and magic number
    {
    int result = 0;
    int total = OrdersTotal();
    for(int i = 0; i < total; i++)
    {
    if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == false) continue;
    if(OrderMagicNumber() != MagicNumber || OrderSymbol() != Symbol() || OrderType() != type) continue;
    result++;
    }
    return(result);
    }

    int myOrderSend(int type, double price, double volume, string ordername) //send order, return ticket ("price" is irrelevant for market orders)
    {
    if(!IsTradeAllowed()) return(-1);
    int ticket = -1;
    int retries = 0;
    int err;
    int long_trades = TradesCount(OP_BUY);
    int short_trades = TradesCount(OP_SELL);
    int long_pending = TradesCount(OP_BUYLIMIT) + TradesCount(OP_BUYSTOP);
    int short_pending = TradesCount(OP_SELLLIMIT) + TradesCount(OP_SELLSTOP);
    string ordername_ = ordername;
    if(ordername != "";)
    ordername_ = ":'("+ordername+";)";
    //test Hedging
    if(!Hedging && ((type % 2 == 0 && short_trades + short_pending > 0) || (type % 2 == 1 && long_trades + long_pending > 0)))
    {
    myAlert("print", "Order"+ordername_+" not sent, hedging not allowed";);
    return(-1);
    }
    //test maximum trades
    if((type % 2 == 0 && long_trades >= MaxLongTrades)
    || (type % 2 == 1 && short_trades >= MaxShortTrades)
    || (long_trades + short_trades >= MaxOpenTrades)
    || (type > 1 && long_pending + short_pending >= MaxPendingOrders))
    {
    myAlert("print", "Order"+ordername_+" not sent, maximum reached";);
    return(-1);
    }
    //prepare to send order
    while(IsTradeContextBusy()) Sleep(100);
    RefreshRates();
    if(type == OP_BUY)
    price = Ask;
    else if(type == OP_SELL)
    price = Bid;
    else if(price < 0) //invalid price for pending order
    {
    myAlert("order", "Order"+ordername_+" not sent, invalid price for pending order";);
    return(-1);
    }
    int clr = (type % 2 == 1) ? clrRed : clrBlue;
    while(ticket < 0 && retries < OrderRetry+1)
    {
    ticket = OrderSend(Symbol(), type, NormalizeDouble(volume, LotDigits), NormalizeDouble(price, Digits()), MaxSlippage, 0, 0, ordername, MagicNumber, 0, clr);
    if(ticket < 0)
    {
    err = GetLastError();
    myAlert("print", "OrderSend"+ordername_+" error #"+err+" "+ErrorDescription(err));
    Sleep(OrderWait*1000);
    }
    retries++;
    }
    if(ticket < 0)
    {
    myAlert("error", "OrderSend"+ordername_+" failed "+(OrderRetry+1)+" times; error #"+err+" "+ErrorDescription(err));
    return(-1);
    }
    string typestr[6] = {"Buy", "Sell", "Buy Limit", "Sell Limit", "Buy Stop", "Sell Stop"};
    myAlert("order", "Order sent"+ordername_+": "+typestr[type]+" "+Symbol()+" Magic #"+MagicNumber);
    return(ticket);
    }

    void myOrderClose(int type, int volumepercent, string ordername) //close open orders for current symbol, magic number and "type" (OP_BUY or OP_SELL)
    {
    if(!IsTradeAllowed()) return;
    if (type > 1)
    {
    myAlert("error", "Invalid type in myOrderClose";);
    return;
    }
    bool success = false;
    int err;
    string ordername_ = ordername;
    if(ordername != "";)
    ordername_ = ":'("+ordername+";)";
    int total = OrdersTotal();
    for(int i = total-1; i >= 0; i--)
    {
    while(IsTradeContextBusy()) Sleep(100);
    if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
    if(OrderMagicNumber() != MagicNumber || OrderSymbol() != Symbol() || OrderType() != type) continue;
    while(IsTradeContextBusy()) Sleep(100);
    RefreshRates();
    double price = (type == OP_SELL) ? Ask : Bid;
    double volume = NormalizeDouble(OrderLots()*volumepercent * 1.0 / 100, LotDigits);
    if (NormalizeDouble(volume, LotDigits) == 0) continue;
    success = OrderClose(OrderTicket(), volume, NormalizeDouble(price, Digits()), MaxSlippage, clrWhite);
    if(!success)
    {
    err = GetLastError();
    myAlert("error", "OrderClose"+ordername_+" failed; error #"+err+" "+ErrorDescription(err));
    }
    }
    string typestr[6] = {"Buy", "Sell", "Buy Limit", "Sell Limit", "Buy Stop", "Sell Stop"};
    if(success) myAlert("order", "Orders closed"+ordername_+": "+typestr[type]+" "+Symbol()+" Magic #"+MagicNumber);
    }

    //+------------------------------------------------------------------+
    //| Expert initialization function |
    //+------------------------------------------------------------------+
    int OnInit()
    {
    //initialize myPoint
    myPoint = Point();
    if(Digits() == 5 || Digits() == 3)
    {
    myPoint *= 10;
    MaxSlippage *= 10;
    }
    //initialize LotDigits
    double LotStep = MarketInfo(Symbol(), MODE_LOTSTEP);
    if(LotStep >= 1) LotDigits = 0;
    else if(LotStep >= 0.1) LotDigits = 1;
    else if(LotStep >= 0.01) LotDigits = 2;
    else LotDigits = 3;
    LastTradeTime = 0;
    return(INIT_SUCCEEDED);
    }

    //+------------------------------------------------------------------+
    //| Expert deinitialization function |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
    {
    }

    //+------------------------------------------------------------------+
    //| Expert tick function |
    //+------------------------------------------------------------------+
    void OnTick()
    {
    int ticket = -1;
    double price;


    //Close Long Positions
    if(iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != EMPTY_VALUE //3_Level_ZZ_Semafor is not equal to fixed value
    && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) >= 70 //Relative Strength Index >= fixed value
    )
    {
    if(IsTradeAllowed())
    myOrderClose(OP_BUY, 100, "";);
    else //not autotrading => only send alert
    myAlert("order", "";);
    }

    //Close Short Positions
    if(iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != EMPTY_VALUE //3_Level_ZZ_Semafor is not equal to fixed value
    && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) <= 30 //Relative Strength Index <= fixed value
    )
    {
    if(IsTradeAllowed())
    myOrderClose(OP_SELL, 100, "";);
    else //not autotrading => only send alert
    myAlert("order", "";);
    }

    //Open Buy Order
    if(iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != EMPTY_VALUE //3_Level_ZZ_Semafor is not equal to fixed value
    && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) <= 30 //Relative Strength Index <= fixed value
    )
    {
    RefreshRates();
    price = Ask;
    if(TimeCurrent() - LastTradeTime < NextOpenTradeAfterBars * PeriodSeconds()) return; //next open trade after time
    if(IsTradeAllowed())
    {
    ticket = myOrderSend(OP_BUY, price, TradeSize, "";);
    if(ticket <= 0) return;
    }
    else //not autotrading => only send alert
    myAlert("order", "";);
    LastTradeTime = TimeCurrent();
    }

    //Open Sell Order
    if(iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != EMPTY_VALUE //3_Level_ZZ_Semafor is not equal to fixed value
    && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) >= 70 //Relative Strength Index >= fixed value
    )
    {
    RefreshRates();
    price = Bid;
    if(TimeCurrent() - LastTradeTime < NextOpenTradeAfterBars * PeriodSeconds()) return; //next open trade after time
    if(IsTradeAllowed())
    {
    ticket = myOrderSend(OP_SELL, price, TradeSize, "";);
    if(ticket <= 0) return;
    }
    else //not autotrading => only send alert
    myAlert("order", "";);
    LastTradeTime = TimeCurrent();
    }
    }
    //+------------------------------------------------------------------+
  • kaliloup

    J'ai compris, les points virgules forment des smiley dans le texte ça cause des soucis.
  • kaliloup

    Si tu veux je te l'envoi par mail. Quand j'ai pris ton code c’était pareil au niveau des erreurs + de 30 mdr...
  • kaliloup

    Code
    //+------------------------------------------------------------------+ //| Strategy: LEVEL2.mq4 | //| Created with EABuilder.com | //| http://eabuilder.com | //+------------------------------------------------------------------+ #property copyright "Created with EABuilder.com" #property link "http://eabuilder.com" #property version "1.00" #property description "" #include <stdlib.mqh> #include <stderror.mqh> int LotDigits; //initialized in OnInit extern int MagicNumber = 1332102; extern int NextOpenTradeAfterBars = 8; //next open trade after time datetime LastTradeTime = 0; extern double TradeSize = 1; extern int MaxSlippage = 3; //adjusted in OnInit extern int MaxOpenTrades = 7; int MaxLongTrades = 1000; int MaxShortTrades = 1000; int MaxPendingOrders = 1000; bool Hedging = false; int OrderRetry = 5; //# of retries if sending order returns error int OrderWait = 5; //# of seconds to wait if sending order returns error double myPoint; //initialized in OnInit void myAlert(string type, string message) { if(type == "print") Print(message); else if(type == "error") { Print(type+" | LEVEL2 @ "+Symbol()+","+Period()+" | "+message); } else if(type == "order") { } else if(type == "modify") { } } int TradesCount(int type) //returns # of open trades for order type, current symbol and magic number { int result = 0; int total = OrdersTotal(); for(int i = 0; i < total; i++) { if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == false) continue; if(OrderMagicNumber() != MagicNumber || OrderSymbol() != Symbol() || OrderType() != type) continue; result++; } return(result); } int myOrderSend(int type, double price, double volume, string ordername) //send order, return ticket ("price" is irrelevant for market orders) { if(!IsTradeAllowed()) return(-1); int ticket = -1; int retries = 0; int err; int long_trades = TradesCount(OP_BUY); int short_trades = TradesCount(OP_SELL); int long_pending = TradesCount(OP_BUYLIMIT) + TradesCount(OP_BUYSTOP); int short_pending = TradesCount(OP_SELLLIMIT) + TradesCount(OP_SELLSTOP); string ordername_ = ordername; if(ordername != "") ordername_ = ":'("+ordername+";)"; //test Hedging if(!Hedging && ((type % 2 == 0 && short_trades + short_pending > 0) || (type % 2 == 1 && long_trades + long_pending > 0))) { myAlert("print", "Order"+ordername_+" not sent, hedging not allowed"); return(-1); } //test maximum trades if((type % 2 == 0 && long_trades >= MaxLongTrades) || (type % 2 == 1 && short_trades >= MaxShortTrades) || (long_trades + short_trades >= MaxOpenTrades) || (type > 1 && long_pending + short_pending >= MaxPendingOrders)) { myAlert("print", "Order"+ordername_+" not sent, maximum reached"); return(-1); } //prepare to send order while(IsTradeContextBusy()) Sleep(100); RefreshRates(); if(type == OP_BUY) price = Ask; else if(type == OP_SELL) price = Bid; else if(price < 0) //invalid price for pending order { myAlert("order", "Order"+ordername_+" not sent, invalid price for pending order"); return(-1); } int clr = (type % 2 == 1) ? clrRed : clrBlue; while(ticket < 0 && retries < OrderRetry+1) { ticket = OrderSend(Symbol(), type, NormalizeDouble(volume, LotDigits), NormalizeDouble(price, Digits()), MaxSlippage, 0, 0, ordername, MagicNumber, 0, clr); if(ticket < 0) { err = GetLastError(); myAlert("print", "OrderSend"+ordername_+" error #"+err+" "+ErrorDescription(err)); Sleep(OrderWait*1000); } retries++; } if(ticket < 0) { myAlert("error", "OrderSend"+ordername_+" failed "+(OrderRetry+1)+" times; error #"+err+" "+ErrorDescription(err)); return(-1); } string typestr[6] = {"Buy", "Sell", "Buy Limit", "Sell Limit", "Buy Stop", "Sell Stop"}; myAlert("order", "Order sent"+ordername_+": "+typestr[type]+" "+Symbol()+" Magic #"+MagicNumber); return(ticket); } void myOrderClose(int type, int volumepercent, string ordername) //close open orders for current symbol, magic number and "type" (OP_BUY or OP_SELL) { if(!IsTradeAllowed()) return; if (type > 1) { myAlert("error", "Invalid type in myOrderClose"); return; } bool success = false; int err; string ordername_ = ordername; if(ordername != "") ordername_ = ":'("+ordername+";)"; int total = OrdersTotal(); for(int i = total-1; i >= 0; i--) { while(IsTradeContextBusy()) Sleep(100); if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue; if(OrderMagicNumber() != MagicNumber || OrderSymbol() != Symbol() || OrderType() != type) continue; while(IsTradeContextBusy()) Sleep(100); RefreshRates(); double price = (type == OP_SELL) ? Ask : Bid; double volume = NormalizeDouble(OrderLots()*volumepercent * 1.0 / 100, LotDigits); if (NormalizeDouble(volume, LotDigits) == 0) continue; success = OrderClose(OrderTicket(), volume, NormalizeDouble(price, Digits()), MaxSlippage, clrWhite); if(!success) { err = GetLastError(); myAlert("error", "OrderClose"+ordername_+" failed; error #"+err+" "+ErrorDescription(err)); } } string typestr[6] = {"Buy", "Sell", "Buy Limit", "Sell Limit", "Buy Stop", "Sell Stop"}; if(success) myAlert("order", "Orders closed"+ordername_+": "+typestr[type]+" "+Symbol()+" Magic #"+MagicNumber); } //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //initialize myPoint myPoint = Point(); if(Digits() == 5 || Digits() == 3) { myPoint *= 10; MaxSlippage *= 10; } //initialize LotDigits double LotStep = MarketInfo(Symbol(), MODE_LOTSTEP); if(LotStep >= 1) LotDigits = 0; else if(LotStep >= 0.1) LotDigits = 1; else if(LotStep >= 0.01) LotDigits = 2; else LotDigits = 3; LastTradeTime = 0; return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { int ticket = -1; double price; //Close Long Positions if(iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != EMPTY_VALUE //3_Level_ZZ_Semafor is not equal to fixed value && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) >= 70 //Relative Strength Index >= fixed value ) { if(IsTradeAllowed()) myOrderClose(OP_BUY, 100, ""); else //not autotrading => only send alert myAlert("order", ""); } //Close Short Positions if(iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != EMPTY_VALUE //3_Level_ZZ_Semafor is not equal to fixed value && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) <= 30 //Relative Strength Index <= fixed value ) { if(IsTradeAllowed()) myOrderClose(OP_SELL, 100, ""); else //not autotrading => only send alert myAlert("order", ""); } //Open Buy Order if(iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 4, 0) != EMPTY_VALUE //3_Level_ZZ_Semafor is not equal to fixed value && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) <= 30 //Relative Strength Index <= fixed value ) { RefreshRates(); price = Ask; if(TimeCurrent() - LastTradeTime < NextOpenTradeAfterBars * PeriodSeconds()) return; //next open trade after time if(IsTradeAllowed()) { ticket = myOrderSend(OP_BUY, price, TradeSize, ""); if(ticket <= 0) return; } else //not autotrading => only send alert myAlert("order", ""); LastTradeTime = TimeCurrent(); } //Open Sell Order if(iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != 0 && iCustom(NULL, PERIOD_CURRENT, "3_Level_ZZ_Semafor", 5, 13, 34, "1,3", "8,5", "21,12", 140, 141, 142, 5, 0) != EMPTY_VALUE //3_Level_ZZ_Semafor is not equal to fixed value && iRSI(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, 0) >= 70 //Relative Strength Index >= fixed value ) { RefreshRates(); price = Bid; if(TimeCurrent() - LastTradeTime < NextOpenTradeAfterBars * PeriodSeconds()) return; //next open trade after time if(IsTradeAllowed()) { ticket = myOrderSend(OP_SELL, price, TradeSize, ""); if(ticket <= 0) return; } else //not autotrading => only send alert myAlert("order", ""); LastTradeTime = TimeCurrent(); } } //+------------------------------------------------------------------+
  • kaliloup

    Voila, renomme ton indicateur comme déjà expliqué plus haut.
  • thierry8310 — en réponse à kaliloup dans son message #111601

    salut
    ben moi j ai toutes ces lignes d erreurs trop bizard ca
    merci en tout cas mon gars