For a start your stops should be of the format eg. Ask-20*Point rather than Ask-20
CB
deantracy:
Help!! I am pulling my hair out. No matter what I do I cannot get my EA script to generate any trades in the strategy tester, Other EAs seem to work fine. I there something wrong with the script or am I doing something wrong in the Strategy tester?
Script is attached.
Thanks,
Dean
Try this with *point for your integer pip values.
//+------------------------------------------------------------------+
//| Breakout.mq4 |//| Copyright © 2010, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//---- input parameters
extern int MAFast=10;
extern int MASlow=20;
extern int StopLoss=20;
extern int TakeProfit=30;
extern int PositionSize=1;
extern int BreakoutPips=5;
extern string Posture="Bull";
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
if (
iMA(NULL,MAFast,0,0,MODE_SMA,PRICE_MEDIAN,0)
>
iMA(NULL,MASlow,0,0,MODE_SMA,PRICE_MEDIAN,0)
)
Posture = "Bull";
if (
iMA(NULL,MAFast,0,0,MODE_SMA,PRICE_MEDIAN,0)
<
iMA(NULL,MASlow,0,0,MODE_SMA,PRICE_MEDIAN,0)
)
Posture = "Bear";
if (Posture == "Bull")
if (
Ask > BreakoutPips*Point + iMA(NULL,MAFast,0,0,MODE_SMA,PRICE_MEDIAN,0)
)
OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-20*Point,Ask+30*Point,0,16384,0,Green);
if (Posture == "Bear")
if (
Ask < BreakoutPips*Point - iMA(NULL,MAFast,0,0,MODE_SMA,PRICE_MEDIAN,0)
)
OrderSend(Symbol(),OP_SELL,1,Ask,3,Ask+StopLoss*Point,Ask-TakeProfit*Point,0,16384,0,Red);
return(0);
}
Ok,That took care of the no trades issue. I still have problems but I will try to work though them.
Don't mention it.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Help!! I am pulling my hair out. No matter what I do I cannot get my EA script to generate any trades in the strategy tester, Other EAs seem to work fine. I there something wrong with the script or am I doing something wrong in the Strategy tester?
Script is attached.
Thanks,
Dean