Metatrader 5 coding questions / issues - page 22

 
mladen:
There is a version made as indicator, but that limits it largely - only indicators that have an option to use previous indicator data can be applied to it and indicators that are chart dependent (any that should work in a separate window) will not work correctly of such an inidcator That is simply a result of metatrader not making offline chart available for metatrader 5

Mladen, How do we activate previous indicator data of an indicator to be usable on renko? (I tried MACD on it, but it still rely on time chart) If at all we want to make an indicator to be used on renko, what are the areas in the code to pay attention to?

Also, I need your assistance on developing a constant range bar indicator chart (different from renko). Where do we start?

 
funayot:
Mladen, How do we activate previous indicator data of an indicator to be usable on renko? (I tried MACD on it, but it still rely on time chart) If at all we want to make an indicator to be used on renko, what are the areas in the code to pay attention to? Also, I need your assistance on developing a constant range bar indicator chart (different from renko). Where do we start?

funayot

That renko is an indicator and when you apply previous indicator data it will be aplied only to the first buffer of the previous indicator (it can not be used as a chart where you can chose price) and you can not do it from an indicator from a separate sub-window

 

Why did they decide to cancel offline chart and not to give us any other mean of creating those in metatrader 5? All platforms have renko charts and similar - metatrader 5 is the only that will never have it

 
mladen:
funayot That renko is an indicator and when you apply previous indicator data it will be applied only to the first buffer of the previous indicator (it can not be used as a chart where you can chose price) and you can not do it from an indicator from a separate sub-window

Mladen

I got your point. I still think we can adjust existing indicators to work with the renko/range chart indicator. I think it's even possible to write a script that will convert the time based chart to range chart. All I need is your tip/help to tell me what to look into and any reading material to study. I think I can spend some time on this (I'm on summer break )

 
funayot:
Mladen I got your point. I still think we can adjust existing indicators to work with the renko/range chart indicator. I think it's even possible to write a script that will convert the time based chart to range chart. All I need is your tip/help to tell me what to look into and any reading material to study. I think I can spend some time on this (I'm on summer break )

funayot

There is no way to make offline charts in metatrader 5

1. they have never published the data format for metatrader 5 and the way how metatarder 45 is combining the ticks that it has into a time frame chart

2. There is no way to read in any data file that is not an "official" metatrader 5 file (ta thing that would be called "open offline" does not exist in metatrader 5)

Simply go to metatrader->bases->your broker name->history->symbol name and you will see that there is nothing similar to any time frame data file in that folder (and that is the folder from which all the time frames are generated). Cache sub-folder in that folder does contain files like that, but you can not do anything with those simply because there is no format published

______________________

Reanmng some cache file will not work : metatrader 5 frequently returns "wrong time frame" even for a perfectly legal time frames when you try to read it using some of the finctions predicted for that. Imagine what would it do for ""ilegal" cache file

 
mladen:
funayot

There is no way to make offline charts in metatrader 5

1. they have never published the data format for metatrader 5 and the way how metatarder 45 is combining the ticks that it has into a time frame chart

2. There is no way to read in any data file that is not an "official" metatrader 5 file (ta thing that would be called "open offline" does not exist in metatrader 5)

Simply go to metatrader->bases->your broker name->history->symbol name and you will see that there is nothing similar to any time frame data file in that folder (and that is the folder from which all the time frames are generated). Cache sub-folder in that folder does contain files like that, but you can not do anything with those simply because there is no format published

______________________

Reanmng some cache file will not work : metatrader 5 frequently returns "wrong time frame" even for a perfectly legal time frames when you try to read it using some of the finctions predicted for that. Imagine what would it do for ""ilegal" cache file

Okay. Thanks. Pardon my perseverance.

I'd better switch to Metatrader 4. Any help on that? Are there existing renko/range bar chart in mt4 and compatible indicators?

 

If you see something like this :

You have to recompile your code. If you do not have the source, good luck, since metatrader 5 will always be "debugging" your perfectly normal stuff

Files:
meta_what.gif  72 kb
 
mladen:
If you see something like this :

You have to recompile your code. If you do not have the source, good luck, since metatrader 5 will always be "debugging" your perfectly normal stuff

Why doesn't it recompile the code if there is a source?

 

Tried to modify the indicator taken from here:

Blau_TSI

In particular added the code here:

double TSIplus[];

double TSIminus[];

SetIndexBuffer(0,TSIplus,INDICATOR_DATA);

SetIndexBuffer(1,TSIminus,INDICATOR_DATA);

double plus,minus;

if(prev_calculated==0) // if the first call

{

pos=begin4; // then calculate all values ​​starting with a meaningful index

for(i=0;i<pos;i++)

TSIplus=0.0;

TSIminus=0.0;

}

else pos=prev_calculated-1;

for(i=pos;i<rates_total;i++)

{

plus=MainBuffer-MainBuffer;

minus=MainBuffer-MainBuffer;

if (plus > 0.0 && MainBuffer > 0){TSIplus=MainBuffer;}

else TSIplus=0.0;

if (minus > 0.0 && MainBuffer < 0){TSIminus=MainBuffer;}

else TSIminus=0.0;

}

The indicator is drawn, but it is worth close and then open a terminal, scrolling the cursor indicator disappears. When you call in the expert shows zeros.

Files:
tsi.mq5  13 kb
 
QuantF:
Tried to modify the indicator taken from here:

Blau_TSI

In particular added the code here:

double TSIplus[];

double TSIminus[];

SetIndexBuffer(0,TSIplus,INDICATOR_DATA);

SetIndexBuffer(1,TSIminus,INDICATOR_DATA);

double plus,minus;

if(prev_calculated==0) // if the first call

{

pos=begin4; // then calculate all values ​​starting with a meaningful index

for(i=0;i<pos;i++)

TSIplus=0.0;

TSIminus=0.0;

}

else pos=prev_calculated-1;

for(i=pos;i<rates_total;i++)

{

plus=MainBuffer-MainBuffer;

minus=MainBuffer-MainBuffer;

if (plus > 0.0 && MainBuffer > 0){TSIplus=MainBuffer;}

else TSIplus=0.0;

if (minus > 0.0 && MainBuffer < 0){TSIminus=MainBuffer;}

else TSIminus=0.0;

}
The indicator is drawn, but it is worth close and then open a terminal, scrolling the cursor indicator disappears. When you call in the expert shows zeros.

QuantF

Replace these lines of code :

plus=MainBuffer-MainBuffer;

minus=MainBuffer-MainBuffer;[/PHP]

with these

[PHP] plus=MainBuffer-MainBuffer;

minus=MainBuffer-MainBuffer;

In metatrader 5, if not explicitly specified (by using the ArraySetAsSerries()) , buffer indexes are not the same as in metatrader 4. Ie : index i+1 in metatrader 5 does not mean previous value but the next value (it s the same as i-1 in metatrader 4)