Comment coder ? - page 109

 

Gérer plusieurs transactions

Bonjour à tous,

J'essaie de développer un EA qui peut théoriquement entrer une quantité infinie de trades, et gérer pour chaque trade les éléments suivants :

  1. Stop suiveur
  2. Déplacement vers BE
  3. ATR-Trailing Stop
  4. etc

Je sais que des EAs comme swiss army et manageTP peuvent le faire. Mais je ne sais pas comment.

Avez-vous des suggestions ?

 

J'ai besoin d'aide pour écrire un code permettant d'arrêter les transactions après une perte.

Bonjour,

J'ai besoin d'écrire du code pour qu'un expert arrête le trading pendant un nombre d'heures spécifique après une perte ou après deux ou trois pertes consécutives.

Quelqu'un peut-il m'aider ?

 

Codage pour Martinggle avec couverture fermée

Salut l'équipe,

je voudrais rechercher un code qui puisse me fournir la solution de ma stratégie ci-dessous ;

exemples ;

concept martingle-

TP = 23 pips

Pip gaps = 20

OP acheter EU 0.1,0.2,0.4,0.8,1.6 lot

1. si la couche sur le lot 1,6 flottant plus de -20pips alors OP vend EU avec 12.8lot (tp 23).

2. Si le lot 12.8 atteint le TP, fermez toutes les positions EU.

3. si le pip=0 du lot 12.8 est atteint, fermer la position sur Sell EU uniquement.

4. Répétez les situations 1 à 3 si les conditions s'appliquent.

J'ai besoin de votre aide pour me conseiller sur la fonction et les codes.

 

Question sur le codage

Actuellement, ce code fonctionne en vérifiant si l'ouverture actuelle est supérieure à la barre précédente. Ma question est la suivante : comment le modifier si je voulais qu'il vérifie si l'ouverture est supérieure OU ÉGALE à la barre précédente ?

if(Open[0] > Open[0+1] &&

Open[0+1] > Open[0+2] &&

Open[0+2]> Open[0+3] &&

Ouverture[0+3] > Ouverture[0+4] &&

Ouvert[0+4] > Ouvert[0+5] &&

Open[0+5] > Open[0+6]) Ordre = SIGNAL_SELL

Devrais-je simplement ajouter un = à côté du signe supérieur à, comme ceci = > ?

Merci !

 

Essayez ceci :

if(Open[0] => Open[0+1] &&

Open[0+1] => Open[0+2] &&

Open[0+2]=> Open[0+3] &&

Open[0+3] => Open[0+4] &&

Open[0+4] => Open[0+5] &&

Open[0+5] => Open[0+6]) Order = SIGNAL_SELL

 

signaux de conseiller expert inversés

Bonjour

Je joue juste avec ce conseiller expert

#property copyright "FORTRADER.RU"

#property link "http://FORTRADER.RU"

/*

????????? ???????? ?????????? ????????? ???????? ? ?????? ??????? ?? 26 ??? 2008,

??????????? ? ?????? ?? ????? ???? ?????? ? ????? ????????????: letters@fortrader.ru

http://www.fortrader.ru/arhiv.php

A detailed description of the parameters adviser available issue of the journal dated May 26 2008,

suggestions and feedback we will be glad to see in our e-mail: letters@fortrader.ru

http://www.fortrader.ru/arhiv.php

*/

extern string x="????????? MACD:";

extern int FastEMA = 12;

extern int SlowEMA = 24;

int SignalEMA = 9;

extern int predel = 6;

extern string x1="????????? MA:";

extern int SMA1 = 50;

extern int SMA2 = 100;

extern int otstup = 10;

extern string x2="???????? ????? ??? ??????? ????-???? :";

extern int stoplossbars = 6;

extern string x3="??????????? ??? ??????? ?????? ?????? ? ???????? ???????? ???????:";

extern int pprofitum = 2;

extern string x4="?????? ?? ADX:";

extern int enable = 0;

extern int periodADX = 14;

extern double Lots=1;

datetime Bar;int buy,sell,i,a,b;double stoploss,setup2,adx,okbuy,oksell;

int start()

{

buy=0;sell=0;

for( i=0;i<OrdersTotal();i++)

{

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_BUY){buy=1;}

if(OrderType()==OP_SELL){sell=1;}

}

//????????? ??????????

double macd =iMACD(NULL,0,FastEMA,SlowEMA,SignalEMA,PRICE_CLOSE,MODE_MAIN,1);

double sma1 =iMA(NULL,0,SMA1,0,MODE_SMA,PRICE_CLOSE,1);

double sma2 =iMA(NULL,0,SMA2,0,MODE_SMA,PRICE_CLOSE,1);

if(Close[1]<sma2){okbuy=1;}

if(Close[1]>sma2){oksell=1;}

if(enable==1)

{

adx=iADX(NULL,0,14,PRICE_CLOSE,MODE_MAIN,0);

}else{adx=60;}

if(Close[1]+otstup*Point>sma1 && Close[1]+otstup*Point>sma2 && macd>0 && buy==0)

{

buy=0;

for( i=predel;i>0;i--)

{

macd=iMACD(NULL,0,FastEMA,SlowEMA,SignalEMA,PRICE_CLOSE,MODE_MAIN,i);

if(macd<0){buy=2;}

}

if(buy==2 && adx>50 && okbuy==1)

{okbuy=0;

double stoploss=Low;

OrderSend(Symbol(),OP_BUY,Lots,Ask,3,stoploss,0,0,16385,0,Green);

a=0;

}

}

if(Close[1]-otstup*Point<sma1 && Close[1]-otstup*Point<sma2 && macd<0 && sell==0)

{

sell=0;

for( i=predel;i>0;i--)

{

macd=iMACD(NULL,0,FastEMA,SlowEMA,SignalEMA,PRICE_CLOSE,MODE_MAIN,i);

if(macd>0){sell=2;}

}

if(sell==2 && adx>50 && oksell==1)

{oksell=0;

stoploss=High;

OrderSend(Symbol(),OP_SELL,Lots,Bid,3,stoploss,0,0,16385,0,White);

b=0;

}

}

if(buy==2 || buy==1)

{

for( i=0;i<OrdersTotal();i++)

{

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_BUY )

{

double setup2=OrderOpenPrice()+((OrderOpenPrice()-OrderStopLoss())*pprofitum);

if(Close[1]>setup2 && a==0)

{

OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,White);

OrderClose(OrderTicket(),OrderLots()/2,Bid,3,Violet);

a=1;

}

if(a==1 && sma1> Close[1]-otstup*Point)

{

OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);

}

}

}

}

if(sell==2 || sell==1)

{

for( i=0;i<OrdersTotal();i++)

{

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_SELL )

{

setup2=OrderOpenPrice()-((OrderStopLoss()-OrderOpenPrice())*pprofitum);

if(Close[1]<setup2 && b==0)

{

OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,White);

OrderClose(OrderTicket(),OrderLots()/2,Ask,3,Violet);

b=1;

}

if(b==1 && Close[1]-otstup*Point> sma1)

{

OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);

}

}

}

}

return(0);

}

Comment inverser les ordres d' achat et de vente? Je n'arrive pas à le faire fonctionner.

 

Pour simplement inverser OP_BUY avec OP_SELL et l'action inverse dans la bonne codeline.

 
oneg:
Essayez ceci :

if(Open[0] => Open[0+1] &&

Open[0+1] => Open[0+2] &&

Open[0+2]=> Open[0+3] &&

Open[0+3] => Open[0+4] &&

Open[0+4] => Open[0+5] &&

Open[0+5] => Open[0+6]) Order = SIGNAL_SELL

Cela n'a pas fonctionné, mais mettre le signe = après le signe > a fonctionné. Comme ceci :

if(Open[0] >= Open[0+1] &&

Open[0+1] >= Open[0+2] &&

Open[0+2]>= Open[0+3] &&

Ouverture[0+3] >= Ouverture[0+4] &&

Ouvert[0+4] >= Ouvert[0+5] &&

Open[0+5] >= Open[0+6]) Ordre = SIGNAL_SELL

 

Dans ce code, le trailing stop est fixé à 45 pips. Mais le stop suiveur ne semble pas s'activer tant qu'il n'a pas bougé de 45 pips. Comment dois-je le modifier pour que le stop suiveur soit activé lorsque la transaction est placée ?

extern string Remark1 = "== Main Settings ==";

extern int MagicNumber = 0;

extern bool SignalMail = False;

extern bool EachTickMode = true;

extern double Lots = 4;

extern int Slippage = 2;

extern bool UseStopLoss = false;

extern int StopLoss = 100;

extern bool UseTakeProfit = false;

extern int TakeProfit = 15;

extern bool UseTrailingStop = true;

extern int TrailingStop = 45;

extern bool MoveStopOnce = False;

extern int MoveStopWhenPrice = 50;

extern int MoveStopTo = 1;

extern int MaxConcurrentTrades = 2;

//Version 2.01

int BarCount;

int Current;

bool TickCheck = False;

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init() {

BarCount = Bars;

if (EachTickMode) Current = 0; else Current = 1;

return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit() {

return(0);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

int Order = SIGNAL_NONE;

int Total, Ticket;

double StopLossLevel, TakeProfitLevel;

if (EachTickMode && Bars != BarCount) TickCheck = False;

Total = OrdersTotal();

Order = SIGNAL_NONE;

//+------------------------------------------------------------------+

//| Variable Begin |

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

//| Variable End |

//+------------------------------------------------------------------+

//Check position

bool IsTrade = False;

for (int i = 0; i < Total; i ++) {

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

if(OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {

IsTrade = True;

if(OrderType() == OP_BUY) {

//Close

//+------------------------------------------------------------------+

//| Signal Begin(Exit Buy) |

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

//| Signal End(Exit Buy) |

//+------------------------------------------------------------------+

if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {

OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);

if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy");

if (!EachTickMode) BarCount = Bars;

IsTrade = False;

continue;

}

//MoveOnce

if(MoveStopOnce && MoveStopWhenPrice > 0) {

if(Bid - OrderOpenPrice() >= Point * MoveStopWhenPrice) {

if(OrderStopLoss() < OrderOpenPrice() + Point * MoveStopTo) {

OrderModify(OrderTicket(),OrderOpenPrice(), OrderOpenPrice() + Point * MoveStopTo, OrderTakeProfit(), 0, Red);

if (!EachTickMode) BarCount = Bars;

continue;

}

}

}

//Trailing stop

if(UseTrailingStop && TrailingStop > 0) {

if(Bid - OrderOpenPrice() > Point * TrailingStop) {

if(OrderStopLoss() < Bid - Point * TrailingStop) {

OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);

if (!EachTickMode) BarCount = Bars;

continue;

}

}

}

} else {

//Close

//+------------------------------------------------------------------+

//| Signal Begin(Exit Sell) |

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

//| Signal End(Exit Sell) |

//+------------------------------------------------------------------+

if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {

OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange);

if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell");

if (!EachTickMode) BarCount = Bars;

IsTrade = False;

continue;

}

//MoveOnce

if(MoveStopOnce && MoveStopWhenPrice > 0) {

if(OrderOpenPrice() - Ask >= Point * MoveStopWhenPrice) {

if(OrderStopLoss() > OrderOpenPrice() - Point * MoveStopTo) {

OrderModify(OrderTicket(),OrderOpenPrice(), OrderOpenPrice() - Point * MoveStopTo, OrderTakeProfit(), 0, Red);

if (!EachTickMode) BarCount = Bars;

continue;

}

}

}

//Trailing stop

if(UseTrailingStop && TrailingStop > 0) {

if((OrderOpenPrice() - Ask) > (Point * TrailingStop)) {

if((OrderStopLoss() > (Ask + Point * TrailingStop)) || (OrderStopLoss() == 0)) {

OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * TrailingStop, OrderTakeProfit(), 0, DarkOrange);

if (!EachTickMode) BarCount = Bars;

continue;

}

}

}

}

}

}

 

signaux de conseiller expert inversés

quelqu'un peut-il m'aider par skype à modifier certains codes dans un conseiller expert ?

J'en ai trouvé un très bon, mais il y a juste une petite chose à changer.

mon skype est : ctzulu

merci beaucoup

Raison: