Profit/Loss - 221/3 - page 2

 

Here are the Charts

The first one is the 1 hour with the EMA signals ( trend chart )

The second is the 5 min with the signals, I only show the long signals because there are too many. Basically if the cci, osma and zero lag all say long its an entry. ( signal chart)

Match the times to determine the lot size.

Files:
trends.jpg  226 kb
signals.jpg  279 kb
 
Kurka Fund:
Let em know what you need....

Kurka please upload your code, let us know more about your idea and rule exactly, I think there are many programmers are interest in complete it if this EA didnot deponed on "personal sense".......please list out the buy , sell and exit condition, like:

Entry Condition 1:

EMA(6)>EMA(14) && 0stoch(1,1)>0Stoch(0,1) && ....

->buy(),lotsize=...

Entry Condition 2:

EMA(6)<EMA(14) && 0Stoch(1,1)<0Stoch(0,1) && ....

->sell(), lotsize=...

Exit Conditon 1:

......

->Buyexit()

Exit Conditon 2:

......

->Sellexit()

 

1st identify the trend....

There are 6 different trend levels, for both up and down. determined be different EMA crosses.

calculate the trend as follows...

Ema1 = iMA(NULL,0,Ema_1, 0,MODE_EMA, PRICE_CLOSE, SignalCandle);

Ema2 = iMA(NULL,0,Ema_2, 0,MODE_EMA, PRICE_CLOSE, SignalCandle);

Ema3 = iMA(NULL,0,Ema_3, 0,MODE_EMA, PRICE_CLOSE, SignalCandle);

Ema4 = iMA(NULL,0,Ema_4, 0,MODE_EMA, PRICE_CLOSE, SignalCandle);

bool up_1=false,up_2=false,up_3=false,up_4=false,up_5=false,up_6=false;

if(Ema1 > Ema2) up_1 = true;

if(Ema1 > Ema2 && Ema1 > Ema3) up_2 = true;

if(Ema1 > Ema2 && Ema1 > Ema3 && Ema1 > Ema4) up_3 = true;

if(Ema1 > Ema2 && Ema1 > Ema3 && Ema1 > Ema4 && Ema2 > Ema3) up_4 = true;

if(Ema1 > Ema2 && Ema1 > Ema3 && Ema1 > Ema4 && Ema2 > Ema3 && Ema2 > Ema_4) up_5 = true;

if(Ema1 > Ema2 && Ema1 > Ema3 && Ema1 > Ema4 && Ema2 > Ema3 && Ema2 > Ema_4 && Ema3 > Ema4) up_6 = true;

Then determine how many lots to trade (each trend up_1 through up_6 is assigned a value extern int TrendLots 1 through 6, the values are then added together. to determine the size of the position to take if a signal is given..

if( up_1 ) up1 = Trend1Lots; else up1 = 0;

if( up_2 ) up2 = Trend2Lots; else up2 = 0;

if( up_3 ) up3 = Trend3Lots; else up3 = 0;

if( up_4 ) up4 = Trend4Lots; else up4 = 0;

if( up_5 ) up5 = Trend5Lots; else up5 = 0;

if( up_6 ) up6 = Trend6Lots; else up6 = 0;

TrendUp = up1 + up2 + up3 + up4 + up5 + up6;

 

Notice that if a signal is given in the oppisite direction of the trendthe Lot calculation will be 0

 

2nd....

Get the signals ( Trend is done on a 1 hour chart, signals are done with a 5min chart)

Indicators used: CCI, SAR,Zero lag Stoch, OSMA, MACD,AO,Envelopes, Divergence, High Low (breakout).

This is where we have no code...... I would like to use different signals for each trend. Example if up_1 = true use Zero lag stoch && OSMA. if up_6 = true use SAR.

Here are the rules for entry:

0Stoch && OSMA ||

Envelopes && OSMA ||

CCI && OSMA ||

MACD && OSMA ||

Sar && OSMA ||

Diverge && OSMA ||

Breakout && OSMA ||

from 1 hour chart

EMA1 crosses EMA3 && EMA1 EMA2 ||

EMA1 crosses EMA4 && EMA1 EMA2 && EMA1 EMA3

Here are the rules for Exit

CCI

MACD

Diverge

SAR

EMA crosses

Trailing stop

Stop Loss

TakeProfit

 

also for testing purposes / optimization I would like to be able to turn entry / exit signals on or off...

extern bool UseCCI = true;

 

Big picture:

The goal of this EA is to capture many small gains usuaslly 12 pips or less. It is somewhat like a blackjack card counting strategy when the count is high (up_5 or up_6 or down_5 or down_6) it takes a larger position.

When traded manually I can usually pull 3 to 5 trads daily, With an EA I think it will be much more profitable/active.

I have never had a bad trade when the trend count was above 3.

Future goals....

-Hedging in trend 1 and 2

-News alerts on the chart...Connect to data feed and turn EA off before scheduled news event.

-Adding additional signals to catch all movements.

Hope these posts help.

If you need to see the code I have so far (not quite working properly) for devolopment purposes, shoot me an email... kurkafund@yahoo.com

 

Fix for sell

Corrected the sell that's all. Needs more work for the EA to match the intended function, when I get time. I also get "not enough bars" on H4.

Files:
 

I worked on this a little bit today....Compiles but does not make any trades.

I also discovered a way to maximize profits during a trend 6, Using a scalper method that I posted here.

https://www.mql5.com/en/forum/175581

Just dont know how to write the code. but it works great everytime there is a trend 6 with 100% accuracy.( at least on every chart I drew it on.)

Files:
 

Kurku:

the EMA code like this:

double iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)

if EMA works on H1 TimeFrame and period=EMA1 , method=EMA, the code must be:

double Ema1 = iMA(NULL,60,Ema_1, 0,MODE_EMA, PRICE_CLOSE, EmaShift+SignalCandle);

I also found problem on the section:

if (UseOSMA){

double OSMAPrev=iOsMA(NULL,0,OSMASlow,OSMAFast,OSMASignal,PRICE_CLOSE,SignalCandle+1); // period and timeframe must be defined;

double OSMA=iOsMA(NULL,0,OSMASlow,OSMAFast,OSMASignal,PRICE_CLOSE,SignalCandle);

if (OSMA > OSMAPrev) {OSMABUY = true;}

if (OSMA < OSMAPrev) {OSMASELL = true;}

if (OSMA > 0) {OSMAUP = true;}

if (OSMA < 0) {OSMADOWN = true;}

}

else { //it means if UseOSMA==false, OSMABUY=true, OSMASELL=true, OSMAUP=true, OSMADOWN=true //delete this section and have a try

OSMABUY = true;

OSMASELL = true;

OSMAUP = true;

OSMADOWN = true;

}

Reason: