Profit and Signal_close

 

Hi evrybody

I've got a problem with my EA

I put a SIGNAL_CLOSEBUY an a SIGNAL_CLOSE like this :

//***************************************//

if(mas10 =mas20p1) Order=SIGNAL_CLOSEBUY;

if(mas10 > mas20 && mas10p1<=mas20p1) Order=SIGNAL_CLOSESELL;

//**************************************//

//--mas10 = moving average 10

//--mas20 = moving average 20

It works but I'de like to do it ONLY if the profit is UP to 15 pips like this:

if(mas10 =mas20p1 && PROFIT>15) Order=SIGNAL_CLOSEBUY;

I 've try with "TakeProfit" but it was very bad result

How can I do please?

Thank you for the assistance

Files:
test_ea.mq4  16 kb
 

what time frame please so i can test mod

it only seems to trade once

 

sorry its only $profit not pip profit

but may give you idea how to do

I had to change the lots calculation to work on smaller lots

and take out the "not enough money" stuff

Files:
 

Hi Perky

I want to use this EA for 15mn , 1h and 1Day.

I gonna Test you're modification.

I saw a function "AccountProfit"

AccountProfit - MQL4 Documentation

And I'll try to understand how it works to.

Thank you very much for your help. I'll give you the result

 

Hi

I want to use many timeframes : 15mn , 1 h , 1 day

I discover a function "AccountProfit" yesterday .

I'll test your EA and this function

I'll give you the result.

Thank you very very much for your help.

 

Hi

I replace "CloseAllOrders" by "Order=SIGNAL_CLOSEBUY" or " Order=SIGNAL_CLOSESELL " because the first order clause all the trade in the same frame.

******

//if(Profit>=TakeProfit) { CloseAllOrders(); }

if(Profit>=TakeProfit && lastType==1; ) { Order=SIGNAL_CLOSEBUY;}

if(Profit>=TakeProfit && lastType==2; ) { Order=SIGNAL_CLOSESELL;}

Great thanks!

Reason: