Coding help - page 209

 

Hi Mladen Sir,

It is my humble request to you. please recode this indicator which is showing daily open line. In similar fashion I want two indicator code i.e. 1) Previous day High and 2) Previous day Low lines. I am trading in stock option so these indicators needs to adjust time in HH:MM. Thanks in advance

 
alpha24:
Hi Mladen Sir, It is my humble request to you. please recode this indicator which is showing daily open line. In similar fashion I want two indicator code i.e. 1) Previous day High and 2) Previous day Low lines. I am trading in stock option so these indicators needs to adjust time in HH:MM. Thanks in advance

alpha24

With current setting (time zone difference specified to 9 hours and 15 minutes) it can not be adapted to show the info you need in a normal way. Sorry

 

hi Mladen,

can you put 3 mtf customizable on your indicator connorRSI plz ?

connorsrsi.mq4

thx

Files:
 
js497:
hi Mladen,

can you put 3 mtf customizable on your indicator connorRSI plz ?

connorsrsi.mq4

thx

js497

This is a 3 time frame Connors rsi indicator

Files:
 
mladen:
js497 This is a 3 time frame Connors rsi indicator

thx mladen

 
arroganzmaschine:
Hey everyone, hope you can help me.

I need to program an Expert advisor, where I check every tick if a new order is open and modify this order with a stop loss.

How can I check if an order was opened an modify it? The ea doesn't open orders, it just has to check.

Thank you all! You are all very helpful.

Best regards, Max.

Hey mladen, do you have any ideas? That would be great!

Thank you very much.

 
arroganzmaschine:
Hey mladen, do you have any ideas? That would be great! Thank you very much.

arroganzmaschine

You do not need to check if an order is opened. All what the EA needs to check is if the stop loss is what you expect it to be. For that you could use any trailing stop EA that keeps your stop losses at the levels you would like it to be

 
mladen:
arroganzmaschine You do not need to check if an order is opened. All what the EA needs to check is if the stop loss is what you expect it to be. For that you could use any trailing stop EA that keeps your stop losses at the levels you would like it to be

Hi mladen,

thank you for your response. I want to code it on my own. When I send a new order, the EA has to detect this and set a stoploss to this new order. There is only one order in the market. How can I realize that?

 
arroganzmaschine:
Hi mladen, thank you for your response. I want to code it on my own. When I send a new order, the EA has to detect this and set a stoploss to this new order. There is only one order in the market. How can I realize that?

You can use the following code as a start (only some error checks needed to add - tried to keep the code as simple as possible in order to show only the essence of what needs to be done)

extern double StopLoss = 20;

int init() { return(0); }

int deinit() { return(0); }

int start()

{

if (StopLoss<=0) return(0);

for (int i=0; i <= OrdersTotal(); i++)

{

if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;

if (OrderSymbol() != Symbol()) continue;

int ticket = OrderTicket();

double sl = 0;

if (OrderType()==OP_BUY) sl = NormalizeDouble(OrderOpenPrice()-StopLoss*Point*MathPow(10,Digits%2),Digits);

if (OrderType()==OP_SELL) sl = NormalizeDouble(OrderOpenPrice()+StopLoss*Point*MathPow(10,Digits%2),Digits);

if (sl!=0 && sl!=OrderStopLoss())

OrderModify(ticket,OrderOpenPrice(),sl,0,0,CLR_NONE);

}

return(0);

}
Files:
_test_1.mq4  1 kb
 
mladen:
You can use the following code as a start (only some error checks needed to add - tried to keep the code as simple as possible in order to show only the essence of what needs to be done)
extern double StopLoss = 20;

int init() { return(0); }

int deinit() { return(0); }

int start()

{

if (StopLoss<=0) return(0);

for (int i=0; i <= OrdersTotal(); i++)

{

if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;

if (OrderSymbol() != Symbol()) continue;

int ticket = OrderTicket();

double sl = 0;

if (OrderType()==OP_BUY) sl = NormalizeDouble(OrderOpenPrice()-StopLoss*Point*MathPow(10,Digits%2),Digits);

if (OrderType()==OP_SELL) sl = NormalizeDouble(OrderOpenPrice()+StopLoss*Point*MathPow(10,Digits%2),Digits);

if (sl!=0 && sl!=OrderStopLoss())

OrderModify(ticket,OrderOpenPrice(),sl,0,0,CLR_NONE);

}

return(0);

}

Thank you very much!!

Reason: