SRDC Strat Help

 

Hello I am new here and found a strat that someone was talking about called SRDC Support Resistence Daily Chart.

I am new to programming MQ4 as well as to Forex but have been around C, C++, C#, VB and have traded stocks/Options for awhile now.

I made a EA for the Strat and is goes like this. [ATTACH]3069[/ATTACH]

Buy - if it is over or below yesterday High and Low

Sell - for profit of 20pips with a stop loss of 40.

Pretty simple strat so I though it would be a good one to start with. I am not getting such good returns on backtesting as I though I would with it though am I setting something up incorrectly. If someone could like at my code to see if I did something wrong that would be great.

Thanks,

- Jerry

P.S. Also feel free to use this if you would like

Files:
 

Hello maxss280

There's the context of your file, I have never looked into EA before but I thought if someone with a bit of knowledge reading this post might have a better idea about your problem if they saw it.

I've left out the property copyright #property link trade marks.

//---- input parameters

extern int ExtTimeFrame=1; // not used

extern double ExtTakeProfitPips= 0.0020; // Take profit at

extern double ExtStopLossPips= 0.040; // Stoploss to be place above or below order

extern double ExtSpreadFromHighLow= 0.0003; // Spread diffrence

extern int ExtSlippage= 1; //Slippage allowed for order

extern double ExtTrailingStop= 0.0010; // Trailing stop *Not used yet*

extern double ExtLotSize= 0.1; // Size of lots 1 standard .1 mini .01 micro

extern int daysAgo= 1; //How many bars back not the overall range

// will try that later.

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

//| expert initialization function |

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

int Count = 0;

int lastDayTraded =0;

int init()

{

//----

Alert ("Prev Range Break init()");

//----

return(0);

}

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

//| expert deinitialization function |

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

int deinit()

{

//----

Alert ("Prev Range Break deinit()");

//----

return(0);

}

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

//| expert start function |

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

int start()

{

//----

/*

//Test for high low of prev bar

Alert ("Bar high 1 ago ", High[1]);

Alert ("Bar Low 1 Ago ", Low[1]);

*/

double Price = Bid; //Bid price at tick

Count++;

// Alert ("New tick",Count," Price = ",Price); // Alert

// Makes sure no more than 1 open order and not trading more than once a day

if (OrdersTotal() < 1 && Day() != lastDayTraded)

{

// Check if meets condition to open new order

if ((High[daysAgo] + ExtSpreadFromHighLow) < Ask)

{

lastDayTraded = Day();

Print("OrderSend Fired Off for BUY");

openBuyTrade();

}

if ((Low[daysAgo] - ExtSpreadFromHighLow) < Bid)

{

lastDayTraded = Day();

Print("OrderSend Fired Off for SELL");

openSellTrade();

}

}

//----

return(0);

}

void openBuyTrade()

{

int ticket=0;

ticket=OrderSend(Symbol(),OP_BUY,ExtLotSize,Ask,ExtSlippage,Ask-ExtStopLossPips,Ask+ExtTakeProfitPips,"PriceRange_BUY_Order_",16384,0,Green);

if(ticket<0)

{

Print("OrderSend failed with error #",GetLastError());

return(0);

}

}

void openSellTrade()

{

int ticket=0;

ticket=OrderSend(Symbol(),OP_SELL,ExtLotSize,Bid,ExtSlippage,Bid+ExtStopLossPips,Bid-ExtTakeProfitPips,"PriceRange_SELL_Order_",16385,0,Red);

if(ticket<0)

{

Print("OrderSend failed with error #",GetLastError());

return(0);

}

}

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

 

Oh I see something that I did wrong. Little mistake makes a big difference lol messed up on the ""

if ((Low[daysAgo] - ExtSpreadFromHighLow) < Ask)

{
lastDayTraded = Day();
Print("OrderSend Fired Off for SELL");
openSellTrade();
}

Should be

if ((Low[daysAgo] - ExtSpreadFromHighLow) > Ask)

{
lastDayTraded = Day();
Print("OrderSend Fired Off for SELL");
openSellTrade();
}

So the new MQ4 which is working more like it should is here [ATTACH]3078[/ATTACH]

If anyone has anything to add or sees anymore problems please feel free to make the changes and let me know lol new to forex and just toying around atm.

Files: