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

SCALPING SHORT V2

  • lefeuvr3

    Code
    //+------------------------------------------------------------------+ //| SCALPING SHORT V2.mq4 | //| Copyright 2019, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2019, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict extern int TakeProfit = 28; int StopLoss = 0; int ecartask=0; int ecartbid=0; int MagicNumber =27112019; extern int LotFactor=100;//100 <---> 300 int Slippage=0; //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { int total=OrdersTotal(); int i; double OpenLongOrders=0,OpenShortOrders=0,PendLongs=0,PendShorts=0; if(total==0 && OpenLongOrders==0 && OpenShortOrders==0 && PendLongs==0 && PendShorts==0) { openbuy(); sellstop(); } for(i=0;i<total;i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) { int type=OrderType(); if(type == OP_BUY ) {OpenLongOrders=OpenLongOrders+1;} if(type == OP_SELL ) {OpenShortOrders=OpenShortOrders+1;} if(type == OP_BUYSTOP ) {PendLongs=PendLongs+1;} if(type == OP_SELLSTOP ) {PendShorts=PendShorts+1;} if(total==1 && OpenLongOrders==0 && OpenShortOrders==0 && (PendLongs==1 || PendShorts==1)) { deleteallpendingorders(); } } } } //+------------------------------------------------------------------+ //| openbuy | //+------------------------------------------------------------------+ void openbuy() { int ticket= OrderSend(Symbol(),OP_BUY,(AccountBalance() * 0.01 /LotFactor)*1,Ask,5,Ask-StopLoss*Point,Ask+TakeProfit*Point,NULL,MagicNumber,0,clrBlue); if (GetLastError()!=0) Print(" BUY Order Error "+(string)ticket); } //+------------------------------------------------------------------+ //| sellstop | //+------------------------------------------------------------------+ void sellstop() { int ticket =OrderSend(Symbol(),OP_SELLSTOP, (AccountBalance() * 0.01 /LotFactor)*2,Bid-ecartbid*Point,5,(Bid-ecartbid*Point)+StopLoss*Point,(Bid-ecartbid*Point)-TakeProfit*Point,NULL,MagicNumber,0,clrBlue); if (GetLastError()!=0) Print(" SELL Order Error "+(string)ticket); } //+------------------------------------------------------------------+ //| buystop | //+------------------------------------------------------------------+ void buystop() { int ticket= OrderSend(Symbol(),OP_BUYSTOP, (AccountBalance() * 0.01 /LotFactor)*3,Ask+ecartask*Point,5,(Ask+ecartask*Point)-StopLoss*Point,(Ask+ecartask*Point)+TakeProfit*Point,NULL,MagicNumber,0,clrBlue); if (GetLastError()!=0) Print(" BUY Order Error "+(string)ticket); } //+------------------------------------------------------------------+ //| deleteallpendingorders | //+------------------------------------------------------------------+ void deleteallpendingorders() { for(int i=0;i<OrdersTotal();i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber && ((OrderType()==OP_BUY) || (OrderType()==OP_SELL) ||(OrderType()==OP_BUYSTOP) || (OrderType()==OP_SELLSTOP) || (OrderType()==OP_BUYLIMIT) || (OrderType()==OP_SELLLIMIT))) { bool modify= OrderDelete(OrderTicket()); } } }
    lefeuvr3 a joint une image
    scalping-short-v2-11867
  • Mikiburger

    Bonjour,


    Merci pour le partage.
    Mais ça ne marche pas du tout chez moi

    Bonne journée,

    Mikhaël
    Mikiburger a joint une image
    scalping-short-v2-11869
  • lefeuvr3

    OK ,je vais revoir le programme en essayant si possible de gagner en short et en long
  • lefeuvr3

    Bonjour
    Après réflexion ,il est possible que cela soit du à un mauvais Backtest de ma part .
    Je pense qu'il faut modifier les paramètres en augmentant "le Spread" ou "Ecart"...il a été réalisé avec... écart actuel(5)...ce qui est le spread du moment sur ma plateforme...en fait je réalise que beaucoup de backtests effectués sur EURUSD sont faits avec des speads allant jusqu' à 20 !
    En fait ce n'est que mon humble avis
  • stani

    Bonjour lefeuvr3

    La qualité de tes BT est d'environ 25%. C'est très insuffisant, 90% n'est déjà pas significatif. Pour avoir quelque chose représentatif, tu dois t'efforcer d'obtenir une qualité de modelage approchant les 99%.
    Apres, un BT, aussi sérieux soit-il, ne représente que l'adaptation de paramètres a un échantillon donné. Tu dois donc ensuite le valider avec un forward test, c'est à dire un test avec les paramètres retenus sur un échantillon de données inconnues.(Avant ou après la période de BT)
    Si les résultats se maintiennent, alors tu peux commencer a espérer.
    Un compte démo pendant plusieurs semaines doit te permettre de valider...ou pas!

    Bon continuation et bon courage a toi.
  • lefeuvr3

    Il s'agit donc d'un problème de backtest a reproduire dans de meilleurs conditions
    Merci