Convert: easyLanguage - page 2

 

THANKS IGORAD!!!!!

Bye

Bolla

 

Hi Igorad how are you?

I nedd your help again.

You translate this part of Easy Language...

if (PositionProfit(1)<0 and PositionProfit(2)<0) then

contr_plus=1;

else contr_plus=0;

...with....

PastTradeProfit();

if ((pastpips[1]+pastpips[2]) < 0 && (pastpips[3]+pastpips[4]) < 0)

{

contr_plus = 1;

}

else

{

contr_plus = 0;

}

...and....

void PastTradeProfit()

{

int total=HistoryTotal(), n=0;

ArrayResize(pastpips,total);

for (int cnt=total-1;cnt>=0;cnt--)

{

if ( OrderSymbol()==Symbol())

{

if (!OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY) && OrderType() > OP_SELL ) continue;

if (OrderType()==OP_BUY)

{n = n+1;

pastpips[n] = MathRound((OrderClosePrice()-OrderOpenPrice())/MarketInfo(Symbol(),MODE_POINT));}

if (OrderType()==OP_SELL)

{n = n+1;

pastpips[n] = MathRound((OrderOpenPrice()-OrderClosePrice())/MarketInfo(Symbol(),MODE_POINT));}

}

}

}

.... in MT4.

But PositionProfit(1) means the yesterday profit and PositionProfit(2) the before yesterday profit. Instead with your MT4 code, there is contr_plus=1 when I have 2 consecutive negative profit trades and not when I have 2 consecutive negative profit days.

Can you change the MT4 code for this purpose?

Thanks

Bolla

 

Hi Bolla, I'm not a programmer so I don't thing that I can help you. But I have a question since you a tradestation user. How accurate is backtest in tradestation? we're all know that MT4's backtest is somehow terrible, how about tradestation?

Thank you

 

Hi Devil, I like TS because is user friendly, EasyLanguage is very "easy" and the back testing is affidable more than MT4. It's possible to make a perfect debug with the Commentary Expert, a function built in TS.

My project is to create a profitable trading system in TS, backtest in TS, translate in MT4, backtest in MT4 (if it's possible) and forward test in MT4 on demo account: if all this step will be positive, I'll try to trade on live account.

My big problem is the MT4 enviroment: I have difficult to translate in mql4 language (I need help...... ), and backtest the EA on MT4.

Bye.

Bolla

 

Hi,

PositionProfit(num) is not profit for past days, it's profit for a previous position.

In your strategy 1 Position = 2 contracts (or 2 lots in MT4), which open simultaneously. So Position(1) = pastpips[1]+pastpips[2] and Position(2) = pastpips[3]+pastpips[4].

Concerning backtesting: in MT4 with 1M data we receive very good coincidence

with real trade.

Igor

 
gbolla:
Hi Devil, I like TS because is user friendly, EasyLanguage is very "easy" and the back testing is affidable more than MT4. It's possible to make a perfect debug with the Commentary Expert, a function built in TS.

My project is to create a profitable trading system in TS, backtest in TS, translate in MT4, backtest in MT4 (if it's possible) and forward test in MT4 on demo account: if all this step will be positive, I'll try to trade on live account.

My big problem is the MT4 enviroment: I have difficult to translate in mql4 language (I need help...... ), and backtest the EA on MT4.

Bye.

Bolla

Hi Bolla, thanks for your respond

 

Hi Igorad, whta's mean with:"Concerning backtesting: in MT4 with 1M data we receive very good coincidence with real trade." ?

Do you use EA on M1 time frame for backtest? Or you use tick analisys with 1M data time frame but the EA is tested on M30 TF?

Thanks.

Bolla

 

Sorry Igorad, I have another question for you.

I would like to stop trade when there are X consecutive negative trades, enter in emulated mode and restart live trade when there are Y consecutive positive trades. I think it's a good idea!

Do you could program this function on our EA?

Thanks a lot.

Bolla

 
gbolla:
Hi Igorad, whta's mean with:"Concerning backtesting: in MT4 with 1M data we receive very good coincidence with real trade." ?

Do you use EA on M1 time frame for backtest? Or you use tick analisys with 1M data time frame but the EA is tested on M30 TF?

Thanks.

Bolla

You can test it : trade couple of days and then make the same on a tester with every tick analysis.

Concerning 2nd question: Good idea, but not simple in realization.

Igor

 

Thanks Igorad for reply.

I hope in your disponibility..... !!

Bolla

Reason: