Rejoindre la communauté
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

Améliorer mon Robot sur stochastic

  • SmErT

    Alors robot et baser sur Stochastic, le principe de fonctionnement et très simple :

    pour le moment j'ai fait la partie Bay (achat)
    2 sur le graphe
    si P<20 et S<20 et P>S achet a un lot donner
    1 sur le graphe
    pour fermer il faut (P>80 et S>80 et P<S) ça se la condition de Sell (vante) et Profit >0
    Sa marche très bien son perte, mais le robot se déclenche rarement

    aaaa le robot et fait avec diagramme pas programmation, sur le site http://strategytune.com/ StrategyTune Visual EA builder

    Code
    #define __STRATEGY_MAGIC 2138633110 //Inputs extern double lots = 0.01; //Declaration double _P; bool _Compare; double _S; bool _Compare_2; bool _Compare_3; bool _Bay; bool _open_bay; bool _Order_Status; bool _AND; bool _Close_bay; double _Order_Data; bool _Compare_4; bool _Compare_5; bool _Compare_6; bool _Compare_7; int start(){ //Level 1 _P = iStochastic(Symbol(),0,14,3,3,1,0,0,0); _S = iStochastic(Symbol(),0,14,3,3,0,0,1,0); _Order_Status = __isBuy(0); _Order_Data = __Profit(0); //Level 2 _Compare = _P < 20; _Compare_2 = _S < 20; _Compare_3 = _P > _S; _Compare_4 = _Order_Data > 0; _Compare_5 = _P > 80; _Compare_6 = _S > 80; _Compare_7 = _P < _S; //Level 3 _Bay = _Compare && _Compare_2 && _Compare_3; _AND = _Order_Status && _Compare_4 && _Compare_5 && _Compare_6 && _Compare_7; //Level 4 if(_Bay && !__isExist(0))_open_bay = OrderSend(Symbol(),0,lots,MarketInfo(Symbol(),MODE_ASK),0,0,0,"",__STRATEGY_MAGIC + 0)>=0; if(_AND)_Close_bay = OrderClose(__Ticket(0),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID)+MarketInfo(OrderSymbol(),MODE_SPREAD)*MarketInfo(OrderSymbol(),MODE_POINT)*(OrderType()==1),0); return(0); } //Services bool __selectOrderByMagic(int __magic){for(int __i=0;__i<OrdersTotal();__i++){if(OrderSelect(__i,SELECT_BY_POS,MODE_TRADES)&&OrderMagicNumber()==__STRATEGY_MAGIC+__magic)return(true);}return(false);} bool __isExist(int __magic){return(__selectOrderByMagic(__magic));} bool __isBuy(int __magic){if(!__selectOrderByMagic(__magic))return(false);return(OrderType()==OP_BUY || OrderType()==OP_BUYLIMIT || OrderType()==OP_BUYSTOP);} int __Ticket(int __magic){if(!__selectOrderByMagic(__magic))return(0);return(OrderTicket());} double __Profit(int __magic){if(!__selectOrderByMagic(__magic))return(0);return(OrderProfit());}

    Comment ajouter le Sell
    Rendre le robot plut fonctionnel car il rate beaucoup d'occasion.
    Modifié le 2013-11-30 18:51:04 par AliX : ne pas cacher les liens, les gens doivent savoir où ils vont
    SmErT a joint une image
    aide-pour-ameliorer-mon-robot-8295
  • SmErT

    Salut a tous.
    Voilà j'ai modifié un peu le code.

    Code
    #define __STRATEGY_MAGIC 1073117269 //Inputs extern double _Min = 20; extern double _Max = 80; extern double _lots = 0.01; //Declaration double _Stochastic_Main_Line; bool _AND; bool _Open_Bay; bool _AND_4; double _Stochastic_Signal_Line; bool _Compare_2; bool _Compare_3; bool _Compare_4; bool _Compare_7; bool _Compare_8; bool _Compare_9; bool _Open_Sell; bool _Status_is_Sell; bool _AND_3; bool _Compare_5; double _Profit; double _Commission; bool _Close_Sell; bool _AND_5; bool _Close_Bay; bool _Order_is_Bay; int start(){ //Level 1 _Stochastic_Main_Line = iStochastic(Symbol(),0,14,6,6,1,1,0,0); _Stochastic_Signal_Line = iStochastic(Symbol(),0,14,6,6,1,1,1,0); _Status_is_Sell = __isSell(0); _Profit = __Profit(0); _Commission = __Commission(0); _Order_is_Bay = __isBuy(0); //Level 2 _Compare_2 = _Stochastic_Main_Line > _Stochastic_Signal_Line; _Compare_3 = _Stochastic_Main_Line < _Min; _Compare_4 = _Stochastic_Signal_Line < _Min; _Compare_7 = _Stochastic_Main_Line < _Stochastic_Signal_Line; _Compare_8 = _Stochastic_Main_Line > _Max; _Compare_9 = _Stochastic_Signal_Line > _Max; _Compare_5 = _Profit >= _Commission; //Level 3 _AND = _Compare_2 && _Compare_3 && _Compare_4; _AND_4 = _Compare_7 && _Compare_8 && _Compare_9; //Level 4 if(_AND && !__isExist(0))_Open_Bay = OrderSend(Symbol(),0,_lots,MarketInfo(Symbol(),MODE_ASK),0,0,0,"",__STRATEGY_MAGIC + 0)>=0; if(_AND_4 && !__isExist(0))_Open_Sell = OrderSend(Symbol(),1,_lots,MarketInfo(Symbol(),MODE_BID),0,0,0,"",__STRATEGY_MAGIC + 0)>=0; _AND_3 = _Status_is_Sell && _Compare_5 && _AND; _AND_5 = _Compare_5 && _Order_is_Bay && _AND_4; //Level 5 if(_AND_3)_Close_Sell = OrderClose(__Ticket(0),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID)+MarketInfo(OrderSymbol(),MODE_SPREAD)*MarketInfo(OrderSymbol(),MODE_POINT)*(OrderType()==1),0); if(_AND_5)_Close_Bay = OrderClose(__Ticket(0),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID)+MarketInfo(OrderSymbol(),MODE_SPREAD)*MarketInfo(OrderSymbol(),MODE_POINT)*(OrderType()==1),0); return(0); } //Services bool __selectOrderByMagic(int __magic){for(int __i=0;__i<OrdersTotal();__i++){if(OrderSelect(__i,SELECT_BY_POS,MODE_TRADES)&&OrderMagicNumber()==__STRATEGY_MAGIC+__magic)return(true);}return(false);} bool __isExist(int __magic){return(__selectOrderByMagic(__magic));} bool __isBuy(int __magic){if(!__selectOrderByMagic(__magic))return(false);return(OrderType()==OP_BUY || OrderType()==OP_BUYLIMIT || OrderType()==OP_BUYSTOP);} bool __isSell(int __magic){if(!__selectOrderByMagic(__magic))return(false);return(OrderType()==OP_SELL || OrderType()==OP_SELLLIMIT || OrderType()==OP_SELLSTOP);} int __Ticket(int __magic){if(!__selectOrderByMagic(__magic))return(0);return(OrderTicket());} double __Profit(int __magic){if(!__selectOrderByMagic(__magic))return(0);return(OrderProfit());} double __Commission(int __magic){if(!__selectOrderByMagic(__magic))return(0);return(OrderCommission());}

    Mais ça ne marche pas, pouvez-vous m’aider ?
    Merci
    SmErT a joint une image
    ameliorer-mon-robot-sur-stochastic-8325
  • john (invité) — en réponse à SmErT dans son message #87861

    ca ne marche pas pour plusieurs raisons

    d'abord, l'algorithme du Stochastic fournit par Metquotes est mauvais. Personnellement, je m'en suis rendu compte et j'ai posté alors ce blog sur beathespread.com
    beathespread.com/file/view/23917/stochastic-corrected

    Certains l'ont vu et corrigé. Mais, moins d'un 1 % des traders

    Donc, si vous persistez à aller chercher une valeur du sto via le broker, la valeur sera pratiquement toujours mauvaise.

    Deuxio
    le choix des parametrage Stochastic Period, K% et D% est extravagant (à mon avis)
    14 pour une periode de stochastic, c'est bcp trop lent, le sto est pls réactif qu'un RSI

    Tertio
    Qu l'on choississe des valeurs courantes pour shift = 0, ok
    //Level 1
    _Stochastic_Main_Line = iStochastic(Symbol(),0,14,6,6,1,1,0,0);
    _Stochastic_Signal_Line = iStochastic(Symbol(),0,14,6,6,1,1,1,0);

    mais ou sont les valeurs de la barre précédente (shift = 1) ,
    Comment allez-vous éliminer les faux -signaux ?

    Bref tout ce genre de questions que bcp d'autres se sont posées avant vous !