Coding help - page 103

 

How is the OrderSelect > SELECT_BY_POS organized?

- only for OrderOpen

- or for each action (OrderOpen and OrderClose)

I only want to know, if today a position is opened by my ea:

for(int i = (OrdersHistoryTotal()-1);i>=0;i--){

OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);

if(OrderMagicNumber()==myMagicNumber && OrderSymbol() == mySymbol){

LastOpen = OrderOpenTime();

int YY=TimeYear(LastOpen);

int MN=TimeMonth(LastOpen);

int DD=TimeDay(LastOpen);

LastOpenEndOfDay = StrToTime(YY2+"."+MN2+"."+DD2+" 23:59");

if(myNow<LastOpenEndOfDay){

return (true);

}

}

}

return (false);

Do I have to search for the whole history??

 
sunshineh:
How is the OrderSelect > SELECT_BY_POS organized?

- only for OrderOpen

- or for each action (OrderOpen and OrderClose)

I only want to know, if today a position is opened by my ea:

for(int i = (OrdersHistoryTotal()-1);i>=0;i--){

OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);

if(OrderMagicNumber()==myMagicNumber && OrderSymbol() == mySymbol){

LastOpen = OrderOpenTime();

int YY=TimeYear(LastOpen);

int MN=TimeMonth(LastOpen);

int DD=TimeDay(LastOpen);

LastOpenEndOfDay = StrToTime(YY2+"."+MN2+"."+DD2+" 23:59");

if(myNow<LastOpenEndOfDay){

return (true);

}

}

}

return (false);

Do I have to search for the whole history??

Yes, you have to

According to metaquotes, there is no guarantee that an order with a bigger order position is opened after an order with smaller order position , hence you have to go through the whole list in order to check your order

 

hi every one i am looking for a MACD indicator that will display the day time frame MACD on the 4hr time frame

thanks every one

Files:
macd_true.mq4  4 kb
 
monjurahmed:
hi every one i am looking for a MACD indicator that will display the day time frame MACD on the 4hr time frame thanks every one

monjurahmed

Try out the one from this post : https://www.mql5.com/en/forum/178018/page9

Set the signal method to 1 (EMA) to get same values as the one you posted, and set the time frame parameter to 1440 to display daily MACD

 

Hi All,

I would like to an EA to check if the closing of every 5th (or x) bar is below/above a simple MA, and gives out an alert every 5 (or x) bar.

I was not able to find a way to make the ea do the checking every 5 or x bars.

Any help, please?

Thank you

 

Hi, I want to create 2 indicator 1.reversal indicator 2. Display Previous candle non repaint color but I don't know the code how can I write

1. Reversal indicator

Rule

When previous candle closed is Bullish next new candle will occur sell arrow

When previous candle closed is Bearish next new candle will occur Buy arrow

I want its non repaint when arrow already occured

2. Display Previous candle non repaint color

I see this idea from the nonlagdot in the mode "color bar back" but it repaint at all when open the new bar or refresh the program mt4

I want to know does it possible to creating in non repaint? I try to edit but I cannot

Please help or suggest me how can I write it? Thank you.

 
tysgels:
Hi, I want to create 2 indicator 1.reversal indicator 2. Display Previous candle non repaint color but I don't know the code how can I write

1. Reversal indicator

Rule

When previous candle closed is Bullish next new candle will occur sell arrow

When previous candle closed is Bearish next new candle will occur Buy arrow

I want its non repaint when arrow already occured

2. Display Previous candle non repaint color

I see this idea from the nonlagdot in the mode "color bar back" but it repaint at all when open the new bar or refresh the program mt4

I want to know does it possible to creating in non repaint? I try to edit but I cannot

Please help or suggest me how can I write it? Thank you.

tysgels

Do you have any part of that indicator already written?

If yes, post it so that someone can help you with your coding

 

Dear Mladen/Mr Tools Can u please fix this ea so that it doesnt reopen trade

stop or tp is hit.. Thanks

Files:
 

Kind Request to code this in mt4 ...

Name : TRIX

Description

Founded by Jack Huston, Trix indicator is a combination of (Rate of Change) and EMA (Exponential Moving Average)

It oscillates above and below zero level, to give reversals

To calculate TRIX, price is first averaged thrice and than Roc of triple smoothened average is calculated

A moving average of Trix is also plotted along to give crossovers and early reversals

Interpretation

TRIX crossing zero level in upward direction gives buy signal

TRIX crossing zero level in downward direction gives sell signal

Since its average is smoothened thrice, signals helps to catch good trends by giving few reversals

Default Parameters Used/Inputs :

Close Line

Trix Period

Avg Period

Formula :

M = EMA(EMA(EMA ,Price ))

TRIX = 100 x [M – M-t / M ]

Thanks a lot

 
rpasupathy:
Kind Request to code this in mt4 ...

Name : TRIX

Description

Founded by Jack Huston, Trix indicator is a combination of (Rate of Change) and EMA (Exponential Moving Average)

It oscillates above and below zero level, to give reversals

To calculate TRIX, price is first averaged thrice and than Roc of triple smoothened average is calculated

A moving average of Trix is also plotted along to give crossovers and early reversals

Interpretation

TRIX crossing zero level in upward direction gives buy signal

TRIX crossing zero level in downward direction gives sell signal

Since its average is smoothened thrice, signals helps to catch good trends by giving few reversals

Default Parameters Used/Inputs :

Close Line

Trix Period

Avg Period

Formula :

M = EMA(EMA(EMA ,Price ))

TRIX = 100 x [M – M-t / M ]

Thanks a lot

rpasupathy

At this post https://www.forex-tsd.com/forum/debates-discussions/116-something-interesting-please-post-here/page97#comment_413012 you can find a TRIX indicator that is coded exactly as Jack Hutson described it in his document (the document attached too)