Conversion Expert Advisor Metatrader - Forex Forum

3 Pages V   1 2 3 >  
Reply to this topicStart new topic
> Conversion Expert Advisor Metatrader
pere noel
post Oct 29 2005, 0:11
Post #1


Member
**

Group: Membre
Posts: 24
Joined: 10-October 05
Member No.: 275



Salut

J'ai un systeme de trading pour meta trader 3.8 et j'aurais besoin de qqun qui me le convertisse pour metatrader 4, systeme très rentable que j'ai utilisé pendant un an en réel, celui qui me le convertit pourra l'utilizer a son aise.

J'attends vos reponses.

Merçi

MN
Go to the top of the page
 
+Quote Post
muscat
post Oct 29 2005, 6:55
Post #2


Member
**

Group: Membre
Posts: 38
Joined: 14-September 05
Member No.: 87



CITATION(pere noel @ Oct 29 2005, 1:11)
Salut

J'ai un systeme de trading pour meta trader 3.8 et j'aurais besoin de qqun qui me le convertisse pour metatrader 4, systeme très rentable que j'ai utilisé pendant un an en réel, celui qui me le convertit pourra l'utilizer a son aise.

J'attends vos reponses.

Merçi

MN
[snapback]1523[/snapback]



si je peux t'aider , avec plaisir mataf_wink.gif
Go to the top of the page
 
+Quote Post
pere noel
post Oct 30 2005, 0:33
Post #3


Member
**

Group: Membre
Posts: 24
Joined: 10-October 05
Member No.: 275



Salut muscat

Oui avec plaisir, je join a ce post le code de mon expert meta 3.8 si tu peux le coder pour meta 4 ce serait super.



/*[[
Name := day time breakout
Author := MN
Link :=
Notes := lower than h1 charts; times GMT.
Lots := 1
Stop Loss := 110
Take Profit := 180
Trailing Stop := 0
]]*/
defines: Slippage(5),settime(1),closetime(21),setuprange(100),risk(12),mm(0);
var: i(0),lotsi(0),p1(0),p2(0),trig(0);

If FreeMargin<100 then Exit;
if mm<>0 then
lotsi=Ceil(Balance*risk/10000)/10
else
lotsi=Lots;
p1=setuprange/2+2;
p2=setuprange/2-2;
if TimeHour(time)=settime and TimeMinute(time)=0 then
If TotalTrades<1 then {
SetOrder(OP_BUYSTOP,lotsi,Bid+p1*Point,Slippage,Bid+p1*point-StopLoss*Point,Bid+(p1+TakeProfit)*Point,blue);
SetOrder(OP_SELLSTOP,lotsi,Bid-p2*Point,Slippage,Bid-p2*point+StopLoss*Point,Bid-(p2+TakeProfit)*Point,green);
trig=0;
};

if trig=0 then {
if TimeHour(time)>settime and TimeHour(time)<closetime then {
if TotalTrades=2 then
for i=1 to TotalTrades {
if ord(i,VAL_TYPE)=OP_BUY then {
trig=1;
DeleteOrder(ord(3-i,VAL_TICKET),white);
SetOrder(OP_SELLSTOP,lotsi*2,Bid-stoploss*Point,Slippage,Bid-stoploss*point+StopLoss*Point,Bid-(stoploss+TakeProfit)*Point,green);
};
if ord(i,VAL_TYPE)=OP_SELL then {
trig=1;
DeleteOrder(ord(3-i,VAL_TICKET),white);
SetOrder(OP_BUYSTOP,lotsi*2,Bid+stoploss*Point,Slippage,Bid+stoploss*point-StopLoss*Point,Bid+(stoploss+TakeProfit)*Point,blue);
};

};
};
};

if TimeHour(time)=closetime and TimeMinute(time)=0 then
for i=1 to TotalTrades {
if ord(i,VAL_TYPE)=OP_BUY then
CloseOrder(ord(i,VAL_TICKET),ord(i,VAL_LOTS),ask,Slippage,red);
if ord(i,VAL_TYPE)=OP_SELL then
CloseOrder(ord(i,VAL_TICKET),ord(i,VAL_LOTS),bid,Slippage,yellow);
if ord(i,VAL_TYPE)=OP_SELLSTOP or ord(i,VAL_TYPE)=OP_BUYSTOP then
DeleteOrder(ord(i,VAL_TICKET),white);
};
if TrailingStop>10 then {
for i=1 to TotalTrades
begin
If Ord(i,VAL_TYPE)=OP_BUY then {
If (Bid-Ord(i,VAL_OPENPRICE))>(TrailingStop*Point) then {
If Ord(i,VAL_STOPLOSS)<(Bid-TrailingStop*Point) then {
ModifyOrder(Ord(i,VAL_TICKET),Ord(i,VAL_OPENPRICE),
Bid-TrailingStop*Point,Ord(i,VAL_TAKEPROFIT),Red);
};
};
};
If Ord(i,VAL_TYPE)=OP_SELL then
{
If (Ord(i,VAL_OPENPRICE)-Ask)>(TrailingStop*Point) then {
If Ord(i,VAL_STOPLOSS)>(Ask+TrailingStop*Point) or
Ord(i,VAL_STOPLOSS)=0 then {
ModifyOrder(Ord(i,VAL_TICKET),Ord(i,VAL_OPENPRICE),
Ask+TrailingStop*Point,Ord(i,VAL_TAKEPROFIT),Red);
};
};
};
end;
};
exit;
Go to the top of the page
 
+Quote Post
muscat
post Oct 30 2005, 15:23
Post #4


Member
**

Group: Membre
Posts: 38
Joined: 14-September 05
Member No.: 87



pere noel, j'ai récupéré ton fichier , je vais voir ca
Go to the top of the page
 
+Quote Post
muscat
post Oct 30 2005, 19:34
Post #5


Member
**

Group: Membre
Posts: 38
Joined: 14-September 05
Member No.: 87



Voici une version sous MT4

il y avait beaucoup de boucles imbriquées, ca a pris un peu de temps

il reste à tester tout ceci dès redémarrage du fx



// Name := day time breakout
// Author := MN modifié par Muscat pour adaptation sur MT4

// Notes := lower than h1 charts; times GMT.
extern double Lots = 1;
extern int StopLoss = 110;
extern int TakeProfit = 180;
extern int TrailingStop = 0;
extern double mm =0;
int Slippage = 5;
int ticket1,ticket2;
double settime=1;
double closetime=21;
double setuprange=100;
double risk=12;
double i=0;
double lotsi = 0;
double p1,p2,trig = 0;

int init()
{

}
int deinit()
{
//----

//----
return(0);
}
int start()
{

if (AccountFreeMargin()<100)
{
return(0);
}


if (mm != 0)
{
lotsi=MathCeil(AccountBalance()*risk/10000)/10;
}
else
{
lotsi=Lots;
}
//}
p1=setuprange/2+2;
p2=setuprange/2-2;


if (Hour()==settime && Minute()==0 && OrdersTotal()<1)
{
ticket1=OrderSend(Symbol(),OP_BUYSTOP,lotsi,Bid+p1*Point,Slippage,Bid+p1*Point-StopLoss*Point,Bid+(p1+TakeProfit)*Point," ",16384,0,Blue);
ticket2=OrderSend(Symbol(),OP_BUYSTOP,lotsi,Bid-p2*Point,Slippage,Bid-p2*Point-StopLoss*Point,Bid-(p2+TakeProfit)*Point," ",16384,0,Green);
trig=0;
}


if (trig==0 && Hour()>settime && Hour()<closetime && OrdersTotal()==2)
{
for (i=1;OrdersTotal()==i;i++)
{
if (OrderType()==OP_BUY)
{
trig=1;
OrderDelete(OrderTicket());
OrderSend(OP_SELLSTOP,lotsi*2,Bid-StopLoss*Point,Slippage,Bid-StopLoss*Point+StopLoss*Point,Bid-(StopLoss+TakeProfit)*Point,Green);
}
if (OrderType()==OP_SELL)
{
trig=1;
OrderDelete(OrderTicket());
OrderSend(OP_BUYSTOP,lotsi*2,Bid+StopLoss*Point,Slippage,Bid+StopLoss*Point-StopLoss*Point,Bid+(StopLoss+TakeProfit)*Point,Blue);
}

} // fin de for
}


if (Hour()==closetime && Minute()==0)
{
for (i=1;OrdersTotal()==i;i++)
{
OrderSelect(i,SELECT_BY_POS);

if(OrderType()==OP_BUY)
{
OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Red);
}
if (OrderType()==OP_SELL)
{
OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Yellow);
}
if (OrderType()==OP_SELLSTOP || OrderType()==OP_BUYSTOP)
{
OrderDelete(OrderTicket());
}
} //fin de for
}// fin de if


if (TrailingStop > 10)
{
for (i=1;OrdersTotal()==i;i++)
{
if (OrderType()==OP_BUY)
{
if (Bid-OrderOpenPrice()>TrailingStop*Point && OrderStopLoss()<Bid-TrailingStop*Point)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*Point,OrderTakeProfit(),Red);
}
}
if (OrderType()==OP_SELL)
{
if (OrderOpenPrice()-Ask>TrailingStop*Point&& OrderStopLoss()>Ask+TrailingStop*Point || OrderStopLoss()==0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+TrailingStop*Point,OrderTakeProfit(),Red);
}
}
} //fin de for

return(0);
} // fin if

}// fin programme

This post has been edited by muscat: Oct 30 2005, 19:35
Go to the top of the page
 
+Quote Post
muscat
post Oct 30 2005, 19:40
Post #6


Member
**

Group: Membre
Posts: 38
Joined: 14-September 05
Member No.: 87



le meme en version directe à coller dans ton MT4

ah non , tiens mataf empeche l'upload d'un fichier metatrader

meme en version source gratuit !!!

This post has been edited by muscat: Oct 30 2005, 19:42
Go to the top of the page
 
+Quote Post
pere noel
post Oct 30 2005, 19:55
Post #7


Member
**

Group: Membre
Posts: 24
Joined: 10-October 05
Member No.: 275



Merçi muscat , je vais tester et je te dis quoi.

This post has been edited by pere noel: Oct 30 2005, 20:30
Go to the top of the page
 
+Quote Post
pere noel
post Oct 31 2005, 0:12
Post #8


Member
**

Group: Membre
Posts: 24
Joined: 10-October 05
Member No.: 275



Salut muscat.

On principe le systeme doit lancer 2 ordres, un ordre buy stop et sell stop simultanement, or la il y a juste l' ordre buy stop qui c'est enclenché. ci ce n'est pas trop te demander peux tu jeter un oeuil.

D'avance merçi.
Go to the top of the page
 
+Quote Post
muscat
post Oct 31 2005, 7:56
Post #9


Member
**

Group: Membre
Posts: 38
Joined: 14-September 05
Member No.: 87



CITATION(pere noel @ Oct 31 2005, 1:12)
Salut muscat.

On principe le systeme doit lancer 2 ordres, un ordre buy stop et sell stop simultanement, or la il y a juste l' ordre buy stop qui c'est enclenché. ci ce n'est pas trop te demander peux tu jeter un oeuil.

D'avance merçi.
[snapback]1566[/snapback]




oui, pardon . un copier coller pas vérifié . essaye ceci :


// Name := day time breakout
// Author := MN modifié par Muscat pour adaptation sur MT4

// Notes := lower than h1 charts; times GMT.
extern double Lots = 1;
extern int StopLoss = 110;
extern int TakeProfit = 180;
extern int TrailingStop = 0;
extern double mm =0;
int Slippage = 5;
int ticket1,ticket2;
double settime=1;
double closetime=21;
double setuprange=100;
double risk=12;
double i=0;
double lotsi = 0;
double p1,p2,trig = 0;

int init()
{

}
int deinit()
{
//----

//----
return(0);
}
int start()
{

if (AccountFreeMargin()<100)
{
return(0);
}


if (mm != 0)
{
lotsi=MathCeil(AccountBalance()*risk/10000)/10;
}
else
{
lotsi=Lots;
}
//}
p1=setuprange/2+2;
p2=setuprange/2-2;


if (Hour()==settime && Minute()==0 && OrdersTotal()<1)
{
ticket1=OrderSend(Symbol(),OP_BUYSTOP,lotsi,Bid+p1*Point,Slippage,Bid+p1*Point-StopLoss*Point,Bid+(p1+TakeProfit)*Point," ",16384,0,Blue);
ticket2=OrderSend(Symbol(),OP_SELLSTOP,lotsi,Bid-p2*Point,Slippage,Bid-p2*Point-StopLoss*Point,Bid-(p2+TakeProfit)*Point," ",16384,0,Green);
trig=0;
}


if (trig==0 && Hour()>settime && Hour()<closetime && OrdersTotal()==2)
{
for (i=1;OrdersTotal()==i;i++)
{
if (OrderType()==OP_BUY)
{
trig=1;
OrderDelete(OrderTicket());
OrderSend(OP_SELLSTOP,lotsi*2,Bid-StopLoss*Point,Slippage,Bid-StopLoss*Point+StopLoss*Point,Bid-(StopLoss+TakeProfit)*Point,Green);
}
if (OrderType()==OP_SELL)
{
trig=1;
OrderDelete(OrderTicket());
OrderSend(OP_BUYSTOP,lotsi*2,Bid+StopLoss*Point,Slippage,Bid+StopLoss*Point-StopLoss*Point,Bid+(StopLoss+TakeProfit)*Point,Blue);
}

} // fin de for
}


if (Hour()==closetime && Minute()==0)
{
for (i=1;OrdersTotal()==i;i++)
{
OrderSelect(i,SELECT_BY_POS);

if(OrderType()==OP_BUY)
{
OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Red);
}
if (OrderType()==OP_SELL)
{
OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Yellow);
}
if (OrderType()==OP_SELLSTOP || OrderType()==OP_BUYSTOP)
{
OrderDelete(OrderTicket());
}
} //fin de for
}// fin de if


if (TrailingStop > 10)
{
for (i=1;OrdersTotal()==i;i++)
{
if (OrderType()==OP_BUY)
{
if (Bid-OrderOpenPrice()>TrailingStop*Point && OrderStopLoss()<Bid-TrailingStop*Point)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*Point,OrderTakeProfit(),Red);
}
}
if (OrderType()==OP_SELL)
{
if (OrderOpenPrice()-Ask>TrailingStop*Point&& OrderStopLoss()>Ask+TrailingStop*Point || OrderStopLoss()==0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+TrailingStop*Point,OrderTakeProfi
t(),Red);
}
}
} //fin de for

return(0);
} // fin if

}// fin programme
Go to the top of the page
 
+Quote Post
pere noel
post Oct 31 2005, 8:44
Post #10


Member
**

Group: Membre
Posts: 24
Joined: 10-October 05
Member No.: 275



J'ai encore le meme prob. seul le buy stop se met en route , mais sur l'expert d'origine sur meta 3.8 j'ai le meme probleme, jusque maintenant cela ne me derrangait pas car je ne prenait que des positions longues, mais la j'aimerais intervenir dans les deux sens.
Si tu arrives a voir d'ou vient le bug ce serait bien.

A+

MN
Go to the top of the page
 
+Quote Post

3 Pages V   1 2 3 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   10 lev10 3,591 29th October 2005 - 12:39
Last post by: lev10
No New Posts   0 danyja 1,565 25th September 2005 - 10:02
Last post by: danyja
No new   81 LeGlac 24,609 6th May 2007 - 17:23
Last post by: LeGlac
No New Posts   0 marcus 1,384 7th November 2005 - 12:32
Last post by: marcus
No New Posts   9 mounafia 2,997 16th December 2005 - 19:54
Last post by: Dazzz

Lo-Fi Version Time is now: 8th January 2009 - 6:33

Welcome Guest ( Log In | Register )

Chat

Forex Forum

English
Français

Economic calendar

[Full Economic calendar]