How to code? - page 196

 

How do you combine trading systems into one EA.

I am looking to have an ma cross and a scalping system both system have different entry and exit.

in essence i am attempting to have short, medium and long term systems in the one ea.

How do you allocate the order open and close functions to each entry and exit condition.

Cheers

Beno

 

Need to Close at end of bar?

I have an ea that I would like for it to close all orders at the end of the bar. I have no idea how to do these. Any help would be greatly appreciated.

platinumplusea.mq4

Files:
 
Beno:
How do you combine trading systems into one EA.

I am looking to have an ma cross and a scalping system both system have different entry and exit.

in essence i am attempting to have short, medium and long term systems in the one ea.

How do you allocate the order open and close functions to each entry and exit condition.

Cheers

Beno

You could keep track with magic numbers.

Ex:

For the short term trade parameters, when you open a trade, assign it a specific magic number. Do the same for your medium term, and long term parameters. Each with their OWN magic numbers.

Then, when it's time to say close your short term trade (even though you may have medium and long term trades open), you close only the order with the specified magic number for short term strategy.

 

code for waiting for new signal

hello everyone,

i have a problem here... with my ea

when i open mt4 my ea open order of old signal...and it's not good for me

Could you give me lines code for tell to the ea to open order only on signal and not in the middle time ???

thanks for help

 
wolfe:
You could keep track with magic numbers.

Ex:

For the short term trade parameters, when you open a trade, assign it a specific magic number. Do the same for your medium term, and long term parameters. Each with their OWN magic numbers.

Then, when it's time to say close your short term trade (even though you may have medium and long term trades open), you close only the order with the specified magic number for short term strategy.

Thanks wolfe

I will give that ago.

 
dr.house7:
hello everyone,

i have a problem here... with my ea

when i open mt4 my ea open order of old signal...and it's not good for me

Could you give me lines code for tell to the ea to open order only on signal and not in the middle time ???

thanks for help

1, add bool flag after trading criteria triggered

2, check bool flag before placing order

3, after placing order bool flag should be reset

4, reset the flag in init() too

 

Indicator readings

Hi,

Would anyone tell me how to get the highest & lowest reading of an indicator over the past 30 days!

thanks,

 

what is the code for

buy area = daily open price + (20% * daily open)

sell area = daily open price - (20% * daily open)

 
toiii:
what is the code for

buy area = daily open price + (20% * daily open)

sell area = daily open price - (20% * daily open)

Here we go,

//--open value for the current day, set the 0 to 1 for the previous day open

double DO=iOpen(NULL, PERIOD_D1, 0);

if(Bid>=(DO+DO*0.2))

OrderSend(set the criteria for BUY);

if(Bid<=(DO-DO*0.2))

OrderSend(set the criteria for SELL);
 
Reason: