Simple MA EA - something missing

 

Hi All !

This is my first post and I am happy to be part of this community now.

Well, I am not new to forex, but recently have been developing and testing EAs using online code generator.

Here are the rules, which I will also show in the pic:

1. Open Buy when SMA 14 is less than current opening price (Shift: Open 2)

2. Close Buy when SMA 14 is greater than current opening price (Shift: Open 3)

3. Open Sell when SMA 14 is greater than current opening price (Shift: Open 2)

4. Close Sell when SMA 14 is less than current opening price (Shift: Open 3)

No SL, No TP, No TS, lot 0.1

Here is the pic:

If the pic is small, please see attached.

Now I developed the code, which I also attached.

Now if we just see the charts, it seems very simple when we should enter or exit the trades.

May be I am missing something, or not setting up my parameters correct. I have tested it as well but the results are not as expected. There should have been many trades because the SMA 14 crossovers occur. So basically this is a scalping type EA.

I would appreciate your kind help in this regard.

Thank you

Files:
 
Shunmas:
Hi All !

This is my first post and I am happy to be part of this community now.

Well, I am not new to forex, but recently have been developing and testing EAs using online code generator.

Here are the rules, which I will also show in the pic:

1. Open Buy when SMA 14 is less than current opening price (Shift: Open 2)

2. Close Buy when SMA 14 is greater than current opening price (Shift: Open 3)

3. Open Sell when SMA 14 is greater than current opening price (Shift: Open 2)

4. Close Sell when SMA 14 is less than current opening price (Shift: Open 3)

No SL, No TP, No TS, lot 0.1

Here is the pic:

If the pic is small, please see attached.

Now I developed the code, which I also attached.

Now if we just see the charts, it seems very simple when we should enter or exit the trades.

May be I am missing something, or not setting up my parameters correct. I have tested it as well but the results are not as expected. There should have been many trades because the SMA 14 crossovers occur. So basically this is a scalping type EA.

I would appreciate your kind help in this regard.

Thank you

Only thing I could find is here

double MyPoint = 1;

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

// expert start function

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

int start()

{

//double MyPoint=Point;

//if(Digits==3 || Digits==5) MyPoint=Point*10;

if (Digits == 3 || Digits == 5)

MyPoint = 10;

else MyPoint = 1;

I commented out

double MyPoint=Point;

if(Digits==3 || Digits==5) MyPoint=Point*10;

In my experience this works best for 5 digit brokers, so maybe try that and see how it works.Other than that from what i can see looks good.

Files:
 
mrtools:
Only thing I could find is here

double MyPoint = 1;

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

// expert start function

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

int start()

{

//double MyPoint=Point;

//if(Digits==3 || Digits==5) MyPoint=Point*10;

if (Digits == 3 || Digits == 5)

MyPoint = 10;

else MyPoint = 1;

I commented out

double MyPoint=Point;

if(Digits==3 || Digits==5) MyPoint=Point*10;

In my experience this works best for 5 digit brokers, so maybe try that and see how it works.Other than that from what i can see looks good.

Thank you for your kind reply Mr.Tools, Yes I tested the modified code as well but again loss on M1. Never mind, I'll keep posting more codes for testing all together and refinements.

Many many thanks again !