
Vous manquez des opportunités de trading :
- Applications de trading gratuites
- Plus de 8 000 signaux à copier
- Actualités économiques pour explorer les marchés financiers
Inscription
Se connecter
Vous acceptez la politique du site Web et les conditions d'utilisation
Si vous n'avez pas de compte, veuillez vous inscrire
Pour acquérir de l'expérience dans ce domaine, j'écrirai gratuitement 25 EA pour vos idées et stratégies intéressantes.
Il ne reste que 19 EA
J'ai un tel problème, j'ai déjà un EA et il fonctionne bien, le problème est avec le bloc de trailing stop. D'une manière ou d'une autre, cela ne fonctionne pas, il n'est pas défini lorsque je négocie. Voici l'EA elle-même. Peut-être avez-vous une idée de ce qui ne va pas avec le trailing stop ? Je n'ai aucune idée de ce que je ferais sans elle.
Ishimoku - MACD .mq4 |
//| TO |
//| http://www.forex-tradexperts-to.narod.ru |
//+------------------------------------------------------------------+
#property copyright "TO"
#lien de propriété "http://www.forex-tradexperts-to.narod.ru"
#include <WinUser32.mqh>
extern string Paramètres=" Ichimoku " ;
interne externe tenkan_sen=3 ;
interne externe kijun_sen=48 ;
externe interne senkou_span_b=52 ;
extern string Paramètres="Moyenne mobile" ;
extern int maPeriod=4 ;
extern int ma_method=1 ;
extern int applied_price=3 ;
extern string Paramètres=" MACD " ;
extern int FastEMA=22 ;
extern int SlowEMA=52 ;
extern int SignalEMA=9 ;
extern string Paramètres=" EA " ;
extern int TP=200 ;
extern int SL=500 ;
extern int slippage=3 ;
extern double lot=0.1 ;
extern bool Add1/*(TENKANSEN resp. KIJUNSEN)*/ =true ;
extern bool Add2/*(TENKANSEN revised Ma)*/=true ;
extern bool trailing=true ;
extern double trailingStop=200 ;
extern int zashita=1 ;
bool buy1=false,buy2=false,buy3=false,buy4=false ;
bool sell1=false,sell2=false,sell3=false,sell4=false,sell22=false ; buy22=false ;
int ticket=0 ;
int i ;
datetime t1=0,t2=1,t3=1,t4=1,t5=1,t7=1,t8=1;
int init()
{
retour(0) ;
}
int deinit()
{
retour(0) ;
}
int start()
{
t1=Temps[0] ;
double MACDRED1=iMACD(NULL,0,FastEMA,SlowEMA,SignalEMA,PRICE_CLOSE,MODE_MAIN,1) ;
double MACDRED2=iMACD(NULL,0,FastEMA,SlowEMA,SignalEMA,PRICE_CLOSE,MODE_MAIN,2) ;
double MACDBLUE1=iMACD(NULL,0,FastEMA,SlowEMA,SignalEMA,PRICE_CLOSE,MODE_SIGNAL,1) ;
double MACDBLUE2=iMACD(NULL,0,FastEMA,SlowEMA,SignalEMA,PRICE_CLOSE,MODE_SIGNAL,2) ;
double IshRed1=iIchimoku(NULL,0,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,1) ;
double IshRed2=iIchimoku(NULL,0,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,2) ;
double IshBlue1=iIchimoku(NULL,0,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,1) ;
double IshBlue2=iIchimoku(NULL,0,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,2) ;
double MA1=iMA(NULL,0,maPeriod,0,ma_method,applied_price,1) ;
double MA2=iMA(NULL,0,MaPeriod,0,ma_method,applied_price,2) ;
if(MACDRED1>MACDBLUE1 && MACDRED2<MACDBLUE2 && t3!=t1)
{ // Signal MACD BUY
buy1=true;sell1=false;t3=Time[0] ;
}
if(MACDRED1<MACDBLUE1 && MACDRED2>MACDBLUE2 && t3!=t1)
{ // Signal MACD SELL
sell1=true;buy1=false;t3=Time[0] ;
}
if(IshRed1>MA1 && IshRed2<=MA2 && t4!=t1)
{ // Le signal Ishimoku croise la MA lors d'un achat.
buy2=true;sell2=false;t4=Time[0] ;
}
if(IshRed1<MA1 && IshRed2>=MA2 && t4!=t1)
{ // Le signal Ishimoku croise la MA en cas de VENTE
sell2=true;buy2=false;t4=Time[0] ;
}
if(IshRed1>IshBlue1 && IshRed2<IshBlue2 && t5!=t1)
{ // Signal Ishimoku Fast crosses Slow à BUY
buy3=true;sell3=false;t5=Time[0] ;
}
if(IshRed1<IshBlue1 && IshRed2>IshBlue2 && t5!=t1)
{ // Signal sur Ishimoku Fast crosses Slow sur SELL
sell3=true;buy3=false;t5=Time[0] ;
}
si(Add1==vrai && buy3==vrai && buy4==vrai && t1!=t8)
{ //ouverture des ajouts
PlaySound("Alert.wav") ;
int=MessageBox("Ajouter un ordre d'achat ?",MB_YESNO|MB_ICONQUESTION) ;
if(ret==6){ticket=OrderSend(Symbol(),OP_BUY,lot,Ask,slippage,Bid-SL*Point,Ask+TP*Point,NULL,0,0,Blue);if(ticket>0)PlaySound("ok.wav");if(ticket<0)Alert("Order not set !!! error - "+GetLastError()+"set manually");}.
t8=Temps[0];buy3=false;buy4=false ;
}
si(Add1==vrai && sell3==vrai && sell4==vrai && t1!=t7)
{ //ouverture des ajouts
PlaySound("Alert.wav") ;
int ret2=MessageBox("Add a Sell order ?",MB_YESNO|MB_ICONQUESTION) ;
si(ret2==6){ticket=OrderSend(Symbol(),OP_SELL,lot,Bid,slippage,Ask-SL*Point,Bid+TP*Point,NULL,0,0,Red);si(ticket>0)PlaySound("ok.wav");if(ticket<0)Alert("Order not set !!! error - "+GetLastError()+"set manually");}.
t7=Temps[0];sell3=false;sell4=false ;
}
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES) ;
si(OrderType()==OP_BUY)
{
buy1=faux;buy2=faux;buy22=vrai ;
pause ;
}
}
if(Add2==vrai && buy22 && IshRed1>MA1 && IshRed2<=MA2 && t4!=t1)
{ // Ajout par Ma et Tenkan_Sen pour acheter
PlaySound("Alert.wav") ;
int ret3=MessageBox("Ajouter un ordre d'achat ?",MB_YESNO|MB_ICONQUESTION) ;
if(ret3==6){ticket=OrderSend(Symbol(),OP_BUY,lot,Ask,slippage,Bid-SL*Point,Ask+TP*Point,NULL,0,0,Blue);if(ticket>0)PlaySound("ok.wav");if(ticket<0)Alert("Order not set !!! error - "+GetLastError()+"set manually");}.
t4=Time[0];buy22=false;
}
if(Add2==vrai && sell22 && IshRed1<MA1 && IshRed2>=MA2 && t4!=t1)
{ // Ajouté par Ma et Tenkan_Sen à Sell
PlaySound("Alert.wav") ;
int ret4=MessageBox("Ajouter un ordre à Vendre ?",MB_YESNO|MB_ICONQUESTION) ;
si(ret4==6){ticket=OrderSend(Symbol(),OP_SELL,lot,Bid,slippage,Ask-SL*Point,Bid+TP*Point,NULL,0,0,Red);si(ticket>0)PlaySound("ok.wav");if(ticket<0)Alert("Order not set !!! error - "+GetLastError()+"set manually");}.
t4=Time[0];sell22=false;
}
si(buy1==vrai && buy2==vrai && t1!=t2)
{ //ouverture des commandes initiales
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES) ;
if(OrderType()==OP_SELL)OrderClose(OrderTicket(),OrderLots(),Ask,slippage,Gold) ;
}
PlaySound("Alert.wav") ;
ticket=OrderSend(Symbol(),OP_BUY,lot,Ask,slippage,Bid-SL*Point,Ask+TP*Point,NULL,0,0,Blue) ;
si(ticket>0)PlaySound("ok.wav") ;
if(ticket<0)Alert("Order not set !!! error - "+GetLastError()+"set manually") ;
t2=Temps[0];buy1=false;buy2=false;buy4=true ;
}
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES) ;
si(OrderType()==OP_SELL)
{
sell1=false;sell2=false;sell22=true ;
pause ;
}
}
si(sell1==vrai && sell2==vrai && t1!=t2)
{ //ouverture des commandes initiales
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES) ;
if(OrderType()==OP_BUY)OrderClose(OrderTicket(),OrderLots(),Bid,slippage,Gold) ;
}
PlaySound("Alert.wav") ;
ticket=OrderSend(Symbol(),OP_SELL,lot,Bid,slippage,Ask+SL*Point,Bid-TP*Point,NULL,0,0,Red) ;
si(ticket>0)PlaySound("ok.wav") ;
if(ticket<0)Alert("Order not set !!! error - "+GetLastError()+"set manually") ;
t2=Temps[0];sell1=faux;sell2=faux;sell4=vrai;buy22=faux ;
}
//Frailing stop
double SL,TP,openprice,profit ;
int ticketOrder,zamok,type ;
string comm ;
for(i=OrdersTotal();i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES) ;
if(trailing==true && OrderProfit()/MarketInfo(Symbol(),MODE_TICKVALUE)>0 && MathFloor(OrderProfit()/MarketInfo(Symbol(),MODE_TICKVALUE)/trailingStop) !=0 && (OrderProfit()/MarketInfo(Symbol(),MODE_TICKVALUE))>=trailingStop*MathFloor(OrderProfit()/MarketInfo(Symbol(),MODE_TICKVALUE)/trailingStop))
{
if(OrderType()==0){SL=Bid-trailingStop*Point;if(SL==OrderOpenPrice())SL+=zashita*Point;}
if(OrderType()==1){SL=Ask+trailingStop*Point;if(SL==OrderOpenPrice())SL-=zashita*Point;}
TP=OrderTakeProfit() ;
if(OrderType()==0)if(SL>=OrderStopLoss()+trailingStop*Point)OrderModify(OrderTicket(),OrderOpenPrice(),SL,TP,0) ;
if(OrderType()==1)if(SL<=OrderStopLoss()-trailingStop*Point)OrderModify(OrderTicket(),OrderOpenPrice(),SL,TP,0) ;
}
}
retour(0) ;
}
Je ne répondrai pas à toutes, mais c'est définitivement un bug :
La dernière commande est OrdersTotal()-1.
pouvez-vous écrire/réaliser un multi EA gratuitement ?
Le mannequin est disponible.
Bonjour, je voudrais vous demander votre aide pour prescrire T/P et Magic_Number dans mon EA. Salutations Timofey.
Bon après-midi.
comment écrirais-tu un tel article ?
double a ; //
double b ; // a et b peuvent prendre n'importe quelle valeur : nombres, lectures d'indicateurs, nombre de ticks pour 500 bougies, etc.
double X ; // valeur de l'écart +-X
si
(a+x et a-x) tombe dans le champ des valeurs (b+x et b-x)
{action}
sinon
{return 0}
Bon après-midi.
comment écrirais-tu un tel article ?
double a ; //
double b ; // a et b peuvent prendre n'importe quelle valeur : nombres, lectures d'indicateurs, nombre de ticks pour 500 bougies, etc.
double X ; // valeur de l'écart +-X
si
(a+x et a-x) tombe dans le champ des valeurs (b+x et b-x)
{action}
sinon
{return 0}
Si x a la même valeur dans tous les cas, vous comparez essentiellement deux nombres a et b. Il n'est pas question d'entrer dans un intervalle ici.
Par exemple, prenons a = 10, b = 11. Donc vous voulez que l'intervalle 12 à 8 tombe dans l'intervalle 13 à 9 ?
Si x est le même dans tous les cas, vous comparez essentiellement deux nombres a et b. Il n'est pas question d'un quelconque intervalle.
Par exemple, prenons a = 10, b = 11. Vous voulez donc que l'intervalle 12 à 8 tombe dans l'intervalle 13 à 9 ?
C'est vrai.