Comment coder ? - page 125

 
: : quel est le problème ? Seulement pour l'EURUSD ? Il est identique à l'autre ? mmmm
LazyForex:
Ha.. Pouvez-vous utiliser la même touche sur votre clavier pour que cela fonctionne également ? Merci !
 
IN10TION:
: : Quel est le problème ? Seulement pour EURUSD ? Il est identique à l'autre ? mmmm

C'est le même problème. Cela fonctionne sur le backtest mais pas sur le forward test. Pas de trades exécutés... Pouvez-vous nous aider ?

 
IN10TION:
: : il était aussi réglé pour ne fonctionner que sur l'EURUSD, j'ai changé cela pour & l'autre restriction... yep... même clé...

En fait, je dois changer l'autre... J'ai vu quelque chose d'autre que je peux faire ... yep ... même clé .

..

partager ce que le résultat sont ok ?

(ou pm moi) comme pour savoir

IN10TION

Votre clavier est à vendre ?

Merci beaucoup. Je vous tiendrai au courant.

 
: : j'ai utilisé quelques clés supplémentaires pour celui-ci... mais vous pouvez l'utiliser pour d'autres devises également, il n'était réglé que pour EURUSD... je ne sais pas pourquoi, vous le saurez mieux j'espère
 
: : il était également configuré pour ne fonctionner que sur l'EURUSD, j'ai désactivé cela et l'autre restriction... oui... même clé...

Au fait, je dois changer l'autre... J'ai vu quelque chose d'autre que je peux faire... yep... même clé...

partagez quel est le résultat ok ? (ou pm moi) j'aimerais savoir

IN10TION

LazyForex:
C'est le même problème. Cela fonctionne sur le backtest mais pas sur le forward test. Pas de trades exécutés... Pouvez-vous m'aider ?
 

Merci beaucoup pour les conseils. J'ai découvert qu'il y a un tick reçu au début de la barre la plus récente dans la plupart des situations (peut-être dans toutes les situations ?) et que je peux donc trader avec le prix ouvert. Ce n'est pas idéal mais (comme il a été dit plus haut) il y a une très petite différence entre le prix de clôture et le prix d'ouverture.

 

Quelle valeur renvoie la fonction iTime ? Est-ce la date de début d'une barre ? Dans le manuel, il est écrit "Returns Time value for the bar of indicated symbol with timeframe and shift".

Merci d'avance pour votre réponse.

 
: : oui, début de la barre
mellda:
Quelle valeur renvoie la fonction iTime ? Est-ce la date de début d'une barre ? Dans le manuel, il est écrit "Returns Time value for the bar of indicated symbol with timeframe and shift". Merci d'avance pour votre réponse.
 
IN10TION:
: : j'ai utilisé quelques clés supplémentaires pour celui-ci... mais vous pouvez l'utiliser pour d'autres devises également, il n'était réglé que pour EURUSD... je ne sais pas pourquoi, vous le saurez mieux j'espère

Bonjour IN10TION,

Je t'ai envoyé un PM...

 

J'ai besoin que l'EA ferme TOUS les ordres une fois que le profit est atteint.

Bonjour, je me demandais juste si l'un de vos grands codeurs pouvait ajouter le code pour fermer TOUS les ordres une fois que g_MinProfit et f_MinProfit sont atteints. Ce que je constate, c'est que lorsque le profit est atteint, il reste des ordres d' achat/vente stop/limite qui traînent et je voudrais qu'ils soient TOUS supprimés une fois que le profit minimum est déclenché.

Merci de votre compréhension.

extern bool g_CLOSE_ALL=false;

extern bool g_RESTART=true;

extern int g_Step=120;

extern double g_FirstLot=0.1;

extern double g_IncLot=0;

extern double g_MinProfit=450;

extern int g_Magic = 2008;

extern string g_comment="Win";

extern bool f_CLOSE_ALL=false;

extern bool f_RESTART=true;

extern int f_Step=120;

extern double f_FirstLot=0.1;

extern double f_IncLot=0;

extern double f_MinProfit=450;

extern int f_Magic = 2009;

extern string f_comment="REV";

int GOrder_Buy=0;

int GOrder_Sell=0;

double GLotSell=0;

double GLotBuy=0;

double gLotSell=0;

double gLotBuy=0;

double gLSP,gLBP;

double gCurrentProfit;

int FOrder_Buy=0;

int FOrder_Sell=0;

double FLotSell=0;

double FLotBuy=0;

double fLotSell=0;

double fLotBuy=0;

double fLSP,fLBP;

double fCurrentProfit;

double max_dd;

//--------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------

int init()

{

Comment("Waddah Attar Win TradeBalancer 1");

if(!GlobalVariableCheck("max_DD")) GlobalVariableSet("max_DD",0);

return(0);

}

int deinit()

{

Comment("");

return(0);

}

//--------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------

int start()

{

gCurrentProfit=GetOrdersProfit(g_Magic);

if (gCurrentProfit>=g_MinProfit || g_CLOSE_ALL)

{

DeletePendingOrders(g_Magic);

CloseOrders(g_Magic);

}

if (MyOrdersTotal(g_Magic)==0 && g_RESTART)

{

OrderSend(Symbol(),OP_BUYLIMIT,g_FirstLot,Ask-g_Step*Point,3,0,0,g_comment,g_Magic,0,Blue);

OrderSend(Symbol(),OP_SELLLIMIT,g_FirstLot,Bid+g_Step*Point,3,0,0,g_comment,g_Magic,0,Red);

}

gLSP=GetLastSellPrice(g_Magic);

gLBP=GetLastBuyPrice(g_Magic);

if((gLSP-Bid)<=5*Point)

{

OrderSend(Symbol(),OP_SELLLIMIT,gLotSell+g_IncLot,gLSP+g_Step*Point,3,0,0,g_comment,g_Magic,0,Red);

}

if((Ask-gLBP)<=5*Point)

{

OrderSend(Symbol(),OP_BUYLIMIT,gLotBuy+g_IncLot,gLBP-g_Step*Point,3,0,0,g_comment,g_Magic,0,Blue);

}

//--------------------------------------------------------------------------------------------

fCurrentProfit=GetOrdersProfit(f_Magic);

if (fCurrentProfit>=f_MinProfit || f_CLOSE_ALL)

{

DeletePendingOrders(f_Magic);

CloseOrders(f_Magic);

}

if (MyOrdersTotal(f_Magic)==0 && f_RESTART)

{

OrderSend(Symbol(),OP_BUYSTOP,f_FirstLot,Ask+f_Step*Point,3,0,0,f_comment,f_Magic,0,Blue);

OrderSend(Symbol(),OP_SELLSTOP,f_FirstLot,Bid-f_Step*Point,3,0,0,f_comment,f_Magic,0,Red);

}

fLSP=GetLastSellPrice(f_Magic);

fLBP=GetLastBuyPrice(f_Magic);

if((Bid-fLSP)<=5*Point)

{

OrderSend(Symbol(),OP_SELLSTOP,fLotSell+f_IncLot,fLSP-f_Step*Point,3,0,0,f_comment,f_Magic,0,Red);

}

if((fLBP-Ask)<=5*Point)

{

OrderSend(Symbol(),OP_BUYSTOP,fLotBuy+f_IncLot,fLBP+f_Step*Point,3,0,0,f_comment,f_Magic,0,Blue);

}

//--------------------------------------------------------------------------------------------

//max_dd=

//--------------------------------------------------------------------------------------------

Comment("Waddah Attar Win TradeBalancer 1",

"\n\n\n\n", " CurrentProfit = ", DoubleToStr(gCurrentProfit,2),

"\n\n", " Buy Lots = ", DoubleToStr(GLotBuy,2) + " / " + GOrder_Buy,

"\n\n", " Sell Lots = ", DoubleToStr(GLotSell,2) + " / " + GOrder_Sell,

"\n\n\n\n", " CurrentProfit = ", DoubleToStr(fCurrentProfit,2),

"\n\n", " Buy Lots = ", DoubleToStr(FLotBuy,2) + " / " + FOrder_Buy,

"\n\n", " Sell Lots = ", DoubleToStr(FLotSell,2) + " / " + FOrder_Sell);

return(0);

}

//--------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------

int DeletePendingOrders(int Magic)

{

int total = OrdersTotal();

for (int cnt = total-1 ; cnt >= 0 ; cnt--)

{

OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);

if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()!=OP_BUY && OrderType()!=OP_SELL))

{

OrderDelete(OrderTicket());

}

}

return(0);

}

//--------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------

int CloseOrders(int Magic)

{

int total = OrdersTotal();

for (int cnt = total-1 ; cnt >= 0 ; cnt--)

{

OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);

if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol())

{

if (OrderType()==OP_BUY)

{

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

}

if (OrderType()==OP_SELL)

{

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

}

}

}

return(0);

}

//--------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------

int MyOrdersTotal(int Magic)

{

int c=0;

int total = OrdersTotal();

if(Magic==g_Magic) { GLotBuy=0; GLotSell=0; GOrder_Buy=0; GOrder_Sell=0; }

if(Magic==f_Magic) { FLotBuy=0; FLotSell=0; FOrder_Buy=0; FOrder_Sell=0; }

for (int cnt = 0 ; cnt < total ; cnt++)

{

OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);

if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol())

{

if(Magic==g_Magic)

{

if(OrderType()==OP_BUY) { GLotBuy=GLotBuy+OrderLots(); GOrder_Buy++; }

if(OrderType()==OP_SELL) { GLotSell=GLotSell+OrderLots(); GOrder_Sell++; }

}

if(Magic==f_Magic)

{

if(OrderType()==OP_BUY) { FLotBuy=FLotBuy+OrderLots(); FOrder_Buy++; }

if(OrderType()==OP_SELL) { FLotSell=FLotSell+OrderLots(); FOrder_Sell++; }

}

c++;

}

}

return(c);

}

//--------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------

double GetLastBuyPrice(int Magic)

{

int total=OrdersTotal()-1;

for (int cnt = total ; cnt >=0 ; cnt--)

{

OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);

if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()==OP_BUYSTOP || OrderType()==OP_BUYLIMIT || OrderType()==OP_BUY))

{

if(Magic==g_Magic) gLotBuy=OrderLots();

if(Magic==f_Magic) fLotBuy=OrderLots();

return(OrderOpenPrice());

}

}

return(0);

}

//--------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------

double GetLastSellPrice(int Magic)

{

int total=OrdersTotal()-1;

for (int cnt = total ; cnt >=0 ; cnt--)

{

OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);

if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()==OP_SELLSTOP || OrderType()==OP_SELLLIMIT || OrderType()==OP_SELL))

{

if(Magic==g_Magic) gLotSell=OrderLots();

if(Magic==f_Magic) fLotSell=OrderLots();

return(OrderOpenPrice());

}

}

return(100000);

}

//--------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------

double GetOrdersProfit(int Magic)

{

double eProfit=0;

int total=OrdersTotal()-1;

for (int cnt = total ; cnt >=0 ; cnt--)

{

OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);

if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()==OP_BUY || OrderType()==OP_SELL))

{

eProfit=eProfit+OrderProfit();

}

}

return(eProfit);

}

//--------------------------------------------------------------------------------------------

Raison: