How to code? - page 9

 

่ีjust write an EA of those indicators

then it will automatically open an order

 
winnysunny:
่ีjust write an EA of those indicators then it will automatically open an order

Well, how to write an EA? and i need it also to close automatically the buy order, when its time to sell and vice versa.

 

the asctrend expert works a similar way.. but with asctrend as indicator.. https://www.mql5.com/en/forum/173249

post your indicator, let us look

 

here it is.

 

Hi t0shiba, could you check this https://www.mql5.com/en/forum/general ? Maybe the EA could help you a bit. Thank you

 

firedave

Today I have looked at an EA you have writen and was inpressed with your coding style. Clean and readable, refreshing. The code was named universal moving cross.

The CockeyedCowboy

 
cockeyedcowboy:
firedave

Today I have looked at an EA you have writen and was inpressed with your coding style. Clean and readable, refreshing. The code was named universal moving cross.

The CockeyedCowboy

Hi Cowboy, thank you for the compliment. I'm learning a lot from this forum. Well, hopefully the EA could at least make some real money for someone

 

Check symbol and EA magicnumber

Hi

Thanks codersguru

The following also checks the symbol and magicnumber (I hope)- so one doesn't get one's ea messing with each other

double GetLastProfit(string symbol1,int magicEA )

{

int total = HistoryTotal();

datetime cur_order = 0;

datetime last_order=0;

double profit=0;

for(int cnt = 0 ; cnt < total ; cnt++)

{

OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY);

if(OrderSymbol()!= symbol1 || OrderMagicNumber() != magicEA) continue;

cur_order = OrderCloseTime();

if(cur_order>last_order)

{

last_order = cur_order;

profit = OrderProfit();

}

}

return (profit);

}

 

how long does history last

Hi

If my machine shuts down and I have to restart my ea - will functions like OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY); - still bring back valid orders - or are these orders only valid for a session of metaquotes?

Any ideas?

I now realize I will have to modify my ea's so that my public variables get persisted to file - and give the user an option to read them back if the user has to restart his machine.

 

Trying to code alert into 3 Line Break indicator

I'm trying to code the 3 Line Break indicator to show a change in trend when it changes color. My programming skills are not good and I'm trying to get it to give an audible and visual alert like "the trend has changed to up". I'm trying to go through the programming lessons and I am seeing if anyone can give some assistance. Thanks.

DeSoft

Files:
Reason: