I have been trying this trading system on Intelliscript chart and it produced around 2000 pips on GBPUSD. since Jan 2006, but I will need help coding it in MQL4 if it is going to be usefull here.
The System takes buy positions only if, GBPUSD is above Weekly EMA (34) and short only positions if GBPUSD is below EMA(34).
The real stoploss I use is 50 pips but it should be a close on 4H and not a fixed stoploss.
the origional formula is as such:
IF (EMA[0](Close, 5)>EMA[1](Close, 5)
AND
EMA[0](Close, 5)< EMA[0](Close, 55))
AND
Close<EMA[0](Close, 55)
AND
ABS(EMA[0](Close, 5)- EMA[0](Close, 55))>=point(10)
AND
ABS(EMA[0](Close, 5)- EMA[1](Close, 5))>=point(1)
THEN
AddBuyEntry
ENDIF
IF (EMA[0](Close, 5)>EMA[1](Close, 5)
AND
(EMA[1](Close, 5)<EMA[2](Close, 5)
AND
ABS(EMA[0](Close, 5)-EMA[0](Close, 55))>=point(100))
/*AND
Close<EMA[0](Close, 55)
AND
ABS(EMA[0](Close, 5)- EMA[0](Close, 55))>=point(30)*/
THEN
AddBuyEntry
ENDIF
IF ((EMA[0](Close, 5)<EMA[1](Close, 5))
AND
Profit(0)>Point(50) THEN
AddBuyExit
ENDIF
IF (Loss(0)>=point(50)) THEN
AddBuyExit
ENDIF
IF (isBuyPosition()THEN
SetBarColor "Blue"
Else
SetBarColor "Red"
ENDIF
Can you tell us what settings you used? The default settings give error signals: "StopLoss less than 50", "TakeProfit less than 50".
Can anyone pls check out the Expert Advisor that I am trying to produce, it seems to have a promissing performance. No trades in the same bar as this produces fake results. Its run on GBPUSD 4 Hours.
You need make a change to this ea for backtesting, cause it uses current bar. and testing results doesn't true.
i'm trying to run it but no trade Generated.
i'm trying to run it but no trade Generated.
Here is the EA code it needs to be run on GBPUSD H4
//+------------------------------------------------------------------+
//| Copyright 2005, Gordago Software Corp. |
//| http://www.gordago.com/ |
//| version 2.0 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2005, Gordago Software Corp."
#property link "http://www.gordago.com"
#define MIN_STOPLOSS_POINT 10
#define MIN_TAKEPROFIT_POINT 10
#define MAGIC 802644
extern string sNameExpert = "Generate from Gordago";
extern int nAccount =0;
extern double dBuyStopLossPoint = 100;
extern double dSellStopLossPoint = 30;
extern double dBuyTakeProfitPoint = 300;
extern double dSellTakeProfitPoint = 10;
extern double dBuyTrailingStopPoint = 0;
extern double dSellTrailingStopPoint = 0;
extern double dLots = 1;
extern int nSlippage = 5;
extern bool lFlagUseHourTrade = False;
extern int nFromHourTrade = 0;
extern int nToHourTrade = 23;
extern bool lFlagUseSound = True;
extern string sSoundFileName = "alert.wav";
extern color colorOpenBuy = Blue;
extern color colorCloseBuy = Aqua;
extern color colorOpenSell = Red;
extern color colorCloseSell = Aqua;
void deinit() {
Comment("");
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start(){
if (lFlagUseHourTrade){
if (!(Hour()>=nFromHourTrade && Hour()<=nToHourTrade)) {
Comment("Time for trade has not come else!");
return(0);
}
}
if(Bars < 100){
Print("bars less than 100");
return(0);
}
if (nAccount > 0 && nAccount != AccountNumber()){
Comment("Trade on account :"+AccountNumber()+" FORBIDDEN!");
return(0);
}
if((dBuyStopLossPoint > 0 && dBuyStopLossPoint < MIN_STOPLOSS_POINT) ||
(dSellStopLossPoint > 0 && dSellStopLossPoint < MIN_STOPLOSS_POINT)){
Print("StopLoss less than " + MIN_STOPLOSS_POINT);
return(0);
}
if((dBuyTakeProfitPoint > 0 && dBuyTakeProfitPoint < MIN_TAKEPROFIT_POINT) ||
(dSellTakeProfitPoint > 0 && dSellTakeProfitPoint < MIN_TAKEPROFIT_POINT)){
Print("TakeProfit less than " + MIN_TAKEPROFIT_POINT);
return(0);
}
double diMA0=iMA(NULL,240,5,0,MODE_EMA,PRICE_CLOSE,0);
double diMA1=iMA(NULL,240,5,0,MODE_EMA,PRICE_CLOSE,1);
double diMA2=iMA(NULL,240,5,0,MODE_EMA,PRICE_CLOSE,0);
double diMA3=iMA(NULL,240,55,0,MODE_EMA,PRICE_CLOSE,0);
double diClose4=iClose(NULL,240,0);
double diMA5=iMA(NULL,240,55,0,MODE_EMA,PRICE_CLOSE,0);
double diMA6=iMA(NULL,240,5,0,MODE_EMA,PRICE_CLOSE,1);
double diMA7=iMA(NULL,240,5,0,MODE_EMA,PRICE_CLOSE,2);
double diMA8=iMA(NULL,240,5,0,MODE_EMA,PRICE_CLOSE,0);
double diMA9=iMA(NULL,240,9,0,MODE_LWMA,PRICE_CLOSE,0);
double diMA10=iMA(NULL,240,5,0,MODE_EMA,PRICE_CLOSE,0);
double diMA11=iMA(NULL,240,5,0,MODE_EMA,PRICE_CLOSE,1);
double diMA12=iMA(NULL,240,5,0,MODE_EMA,PRICE_CLOSE,0);
double diMA13=iMA(NULL,240,55,0,MODE_EMA,PRICE_CLOSE,0);
if(AccountFreeMargin() < (1000*dLots)){
Print("We have no money. Free Margin = " + AccountFreeMargin());
return(0);
}
bool lFlagBuyOpen = false, lFlagSellOpen = false, lFlagBuyClose = false, lFlagSellClose = false;
lFlagBuyOpen = (diMA0>diMA1 && diMA2<diMA3 && diClose4<diMA5 && diMA6diMA9);
lFlagSellOpen = False;
lFlagBuyClose = (diMA10diMA13);
lFlagSellClose = False;
if (!ExistPositions()){
if (lFlagBuyOpen){
OpenBuy();
return(0);
}
if (lFlagSellOpen){
OpenSell();
return(0);
}
}
if (ExistPositions()){
if(OrderType()==OP_BUY){
if (lFlagBuyClose){
bool flagCloseBuy = OrderClose(OrderTicket(), OrderLots(), Bid, nSlippage, colorCloseBuy);
if (flagCloseBuy && lFlagUseSound)
PlaySound(sSoundFileName);
return(0);
}
}
if(OrderType()==OP_SELL){
if (lFlagSellClose){
bool flagCloseSell = OrderClose(OrderTicket(), OrderLots(), Ask, nSlippage, colorCloseSell);
if (flagCloseSell && lFlagUseSound)
PlaySound(sSoundFileName);
return(0);
}
}
}
if (dBuyTrailingStopPoint > 0 || dSellTrailingStopPoint > 0){
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
bool lMagic = true;
if (MAGIC > 0 && OrderMagicNumber() != MAGIC)
lMagic = false;
if (OrderSymbol()==Symbol() && lMagic) {
if (OrderType()==OP_BUY && dBuyTrailingStopPoint > 0) {
if (Bid-OrderOpenPrice() > dBuyTrailingStopPoint*Point) {
if (OrderStopLoss()<Bid-dBuyTrailingStopPoint*Point)
ModifyStopLoss(Bid-dBuyTrailingStopPoint*Point);
}
}
if (OrderType()==OP_SELL) {
if (OrderOpenPrice()-Ask>dSellTrailingStopPoint*Point) {
if (OrderStopLoss()>Ask+dSellTrailingStopPoint*Point || OrderStopLoss()==0)
ModifyStopLoss(Ask+dSellTrailingStopPoint*Point);
}
}
}
}
}
}
return (0);
}
bool ExistPositions() {
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
bool lMagic = true;
if (MAGIC > 0 && OrderMagicNumber() != MAGIC)
lMagic = false;
if (OrderSymbol()==Symbol() && lMagic) {
return(True);
}
}
}
return(false);
}
void ModifyStopLoss(double ldStopLoss) {
bool lFlagModify = OrderModify(OrderTicket(), OrderOpenPrice(), ldStopLoss, OrderTakeProfit(), 0, CLR_NONE);
if (lFlagModify && lFlagUseSound)
PlaySound(sSoundFileName);
}
void OpenBuy() {
double dStopLoss = 0, dTakeProfit = 0;
if (dBuyStopLossPoint > 0)
dStopLoss = Bid-dBuyStopLossPoint*Point;
if (dBuyTakeProfitPoint > 0)
dTakeProfit = Bid + dBuyTakeProfitPoint * Point;
int numorder = OrderSend(Symbol(), OP_BUY, dLots, Ask, nSlippage, dStopLoss, dTakeProfit, sNameExpert, MAGIC, 0, colorOpenBuy);
if (numorder > -1 && lFlagUseSound)
PlaySound(sSoundFileName);
}
void OpenSell() {
double dStopLoss = 0, dTakeProfit = 0;
if (dSellStopLossPoint > 0)
dStopLoss = Ask+dSellStopLossPoint*Point;
if (dSellTakeProfitPoint > 0)
dTakeProfit = Ask-dSellTakeProfitPoint*Point;
int numorder = OrderSend(Symbol(),OP_SELL, dLots, Bid, nSlippage, dStopLoss, dTakeProfit, sNameExpert, MAGIC, 0, colorOpenSell);
if (numorder > -1 && lFlagUseSound)
PlaySound(sSoundFileName);
}
Thank you fxtester. How do noe get this into the expert
directory?
i test it.
i test it right now on GBPUSD 4H and the resulat is 250% .
why i get difrent reasult then you?
i test it right now on GBPUSD 4H and the resulat is 250% . why i get difrent reasult then you?
because I used 10 lots on a $10,000 account.
did anyone forward test this one?
OR?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Can anyone pls check out the Expert Advisor that I am trying to produce, it seems to have a promissing performance. No trades in the same bar as this produces fake results.
Its run on GBPUSD 4 Hours.