Coding help - page 34

 

Code Help - Market Profile

Hi,

I wonder if you could change one indicator, is a market profile and I would just like to add a line with average of daily POCs.

Thank you,

ay-marketprofiledwm.mq4ay-marketprofiledwm.ex4ay-marketprofiledwm.mq4ay-marketprofiledwm.ex4

 
mladen:
kemal44

Actually, when it comes to EAs, you do not need any multi time frame indicator at all. When called from Ea every indicator and the iCustom() call has the desired time frame as the second parameter (for example iCustom( Symbol(), TimeFrame, "Indicator name", .....). Any (even non-multi time frame indicator) can become a multi time frame in an EA by simply specifying time frame different than the current chart time frame in that parameter

Multi time frame indicators are used in manual trading mostly to make possible to traders to visualize some other time frames indicators values on a current chart

Thanks Mladen, for your reply

 

second currency in indicator window

hello, is it possible to have a second currency in window 2?

example : main window EURUSD, second window(where stochastics would be placed) GBPUSD

if possible, can someone please post an example code?

thanks

 

...

marley60

Yes, it is possible. Here is a simple (coding wise) example how it can be done correctly

marley60:
hello, is it possible to have a second currency in window 2?

example : main window EURUSD, second window(where stochastics would be placed) GBPUSD

if possible, can someone please post an example code?

thanks
 

thanx mladen:

I found an indicator which comes real close to what I wanted to do:

RelStrength - I wanted to sum up the 6 outputs of this Indicator and as an end product show this one line.

but my first step RelStrengthBS does not work. what is wrong with it? can anybody tell me?relstrength.mq4relstrengthbs.mq4

Files:
 

...

Try something like this ...

marley60:
thanx mladen:

I found an indicator which comes real close to what I wanted to do:

RelStrength - I wanted to sum up the 6 outputs of this Indicator and as an end product show this one line.

but my first step RelStrengthBS does not work. what is wrong with it? can anybody tell me?relstrength.mq4relstrengthbs.mq4
Files:
code.gif  26 kb
 

Need hand rgading STOPLOSS

Dear Mladen; I would like to add secure profit level If profit distance is bigger then 10 pip , secure profit level should be 5 pip .But I dont knoq how to move my stoploss point to secure profit level if price hit 10 pip profit. Would you mind lead me to write this option into my EA. thanks in advance here is simple trailing code ( written by you ) //+------------------------------------------------------------------+ bool TrailOrders(int ts, int magic) { if(ts(ask+point*ts)+point || OrderStopLoss()==0) { result = OrderModify(OrderTicket(),OrderOpenPrice(),ask+point*ts,OrderTakeProfit(),0,Red); } } } if(OrderType()==OP_BUY) { if(bid-OrderOpenPrice() > point*ts) { if(OrderStopLoss()

 

...

kemal44

What you need a regular trailing stop. For start take a look at this thread (it is an old one, but it does not make it less useful ) https://www.mql5.com/en/forum/175481

If you wish to apply trailing stop only when the order is actually in profit, simply add OrderProfit()+OrderSwap()+OrderCommission() and if the result is > 0, only the apply the trailing stop

kemal44:
Dear Mladen; I would like to add secure profit level If profit distance is bigger then 10 pip , secure profit level should be 5 pip .But I dont knoq how to move my stoploss point to secure profit level if price hit 10 pip profit. Would you mind lead me to write this option into my EA. thanks in advance here is simple trailing code ( written by you ) //+------------------------------------------------------------------+ bool TrailOrders(int ts, int magic) { if(ts(ask+point*ts)+point || OrderStopLoss()==0) { result = OrderModify(OrderTicket(),OrderOpenPrice(),ask+point*ts,OrderTakeProfit(),0,Red); } } } if(OrderType()==OP_BUY) { if(bid-OrderOpenPrice() > point*ts) { if(OrderStopLoss()
 
mladen:
kemal44

What you need a regular trailing stop. For start take a look at this thread (it is an old one, but it does not make it less useful ) https://www.mql5.com/en/forum/175481

If you wish to apply trailing stop only when the order is actually in profit, simply add OrderProfit()+OrderSwap()+OrderCommission() and if the result is > 0, only the apply the trailing stop

there is fair enough code in https://www.mql5.com/en/forum/175481

when add this code into my EA , it says Checktrailingstop and set trailingstop is not referenced, how can I add reference sorry , we are in just learning stage ,

would you mind writing a solution for that?

thanks

 

...

kemal44

Here is a link to a thread where it is explained how to use functions in code : https://www.mql5.com/en/forum/173005

It is explained very good there (and more than I can explain in one post) how to use them

kemal44:
there is fair enough code in https://www.mql5.com/en/forum/175481

when add this code into my EA , it says Checktrailingstop and set trailingstop is not referenced, how can I add reference sorry , we are in just learning stage ,

would you mind writing a solution for that?

thanks
Reason: