Coding help - page 226

 

Dear great programmers,

please help me to modify this Ea to make the possibility of open only buy or only sell order at the start of every cycle.

Sorry for my english.

Thanks

Mark010breakouthedge.mq4

Files:
 
Mark010:
Dear great programmers,

please help me to modify this Ea to make the possibility of open only buy or only sell order at the start of every cycle.

Sorry for my english.

Thanks

Mark010breakouthedge.mq4

Mark010

Do you have the original source code? That is a decompiled code and I doubt that you will get some help with decompiled code changes

 

I don't have it.

Thanks anyway

 
mladen:
elcomepips Here you go

hey mladen,

I saw you coded it very well. Which buffers do I have to import with iCustom() to make an EA out of that. I only want to know if I have to go long or short.

Thanks in advance.

 
arroganzmaschine:
hey mladen,

I saw you coded it very well. Which buffers do I have to import with iCustom() to make an EA out of that. I only want to know if I have to go long or short.

Thanks in advance.

arroganzmaschine

You can use buffer 2 for that. When the value in it is 1, then the trend is up, if the value is -1 then the trend is down. The code could look like this :

double currentTrend = iCustom(NULL,0,"MA crosses arrows_alerts mtf","",FastMa,FastMaShift,FastMAMethod,FastMAPrice,SlowMa,SlowMaShift,SlowMAMethod,SlowMAPrice,2,1);

double previousTrend = iCustom(NULL,0,"MA crosses arrows_alerts mtf","",FastMa,FastMaShift,FastMAMethod,FastMAPrice,SlowMa,SlowMaShift,SlowMAMethod,SlowMAPrice,2,2);

if (currentTrend != previousTrend)

{

if (currentTrend == 1) // buy signal

if (currentTrend == -1) // sell signal

}

 
mladen:
arroganzmaschine

You can use buffer 2 for that. When the value in it is 1, then the trend is up, if the value is -1 then the trend is down. The code could look like this :

double currentTrend = iCustom(NULL,0,"MA crosses arrows_alerts mtf","",FastMa,FastMaShift,FastMAMethod,FastMAPrice,SlowMa,SlowMaShift,SlowMAMethod,SlowMAPrice,2,1);

double previousTrend = iCustom(NULL,0,"MA crosses arrows_alerts mtf","",FastMa,FastMaShift,FastMAMethod,FastMAPrice,SlowMa,SlowMaShift,SlowMAMethod,SlowMAPrice,2,2);

if (currentTrend != previousTrend)

{

if (currentTrend == 1) // buy signal

if (currentTrend == -1) // sell signal

}

How do I have to define FastMa etc? That doesn't work, because it doesn't exist.

 
arroganzmaschine:
How do I have to define FastMa etc? That doesn't work, because it doesn't exist.

You have to declare them as external variables (exactly the same as in indicator parameters). Like this :

extern int FastMa = 5;

extern int FastMaShift = 0;

extern int FastMAMethod = MODE_LWMA;

extern int FastMAPrice = PRICE_CLOSE;

extern int SlowMa = 13;

extern int SlowMaShift = 0;

extern int SlowMAMethod = MODE_LWMA;

extern int SlowMAPrice = PRICE_CLOSE;

use any default values you like instead of the ones from the code above

 
mladen:
You have to declare them as external variables (exactly the same as in indicator parameters). Like this :
extern int FastMa = 5;

extern int FastMaShift = 0;

extern int FastMAMethod = MODE_LWMA;

extern int FastMAPrice = PRICE_CLOSE;

extern int SlowMa = 13;

extern int SlowMaShift = 0;

extern int SlowMAMethod = MODE_LWMA;

extern int SlowMAPrice = PRICE_CLOSE;

use any default values you like instead of the ones from the code above

Thank you very much! How can I only one order if the currentTrend==1?

I don't want to open massive orders.

 
arroganzmaschine:
Thank you very much! How can I only one order if the currentTrend==1? I don't want to open massive orders.

Either use OrdersTotal() < 1 or use some orders counting function for current symbol and magic number

 

Hello Mladen.You made the version this indicator. I want to ask to make here separately moving average, as on the example of other indicator if it is possible.

Thank you.

Files:
Reason: