INDICATOR_MAXIMUM function not working on visual mode of strategy tester.

 

Hello People.

I have very simple two code lines to fit separate chart window for my histogram like this: 

 

IndicatorSetDouble(INDICATOR_MINIMUM, min);
IndicatorSetDouble(INDICATOR_MAXIMUM, max);

This two code line works perfectly when I attach my indicator on chart.

However, when I apply my indicators on visual mode of Strategy Tester, these two code lines are not executed and chart (the separate window) is not fit to my histogram as I want.

Just curious if someone experience the same thing as me. Is there any workaround on this problem ?

Thanks in advance.  

Kind regards.

 
Tried with Ultimate_Oscillator from Indicators\Examples. It works without problem.
 
angevoyageur:
Tried with Ultimate_Oscillator from Indicators\Examples. It works without problem.

Thanks but I didn't mentioned that the two code lines not placed inside "OnInit()" but it is called from "OnCalculate()" function whenever user change input variable.

So the code is slightly different from Ulimate Oscillator because I need to sue IndicatorSetDouble function dynamically from OnCalculate. :) :)

 
FinanceEngineer:

Thanks but I didn't mentioned that the two code lines not placed inside "OnInit()" but it is called from "OnCalculate()" function whenever user change input variable.

So the code is slightly different from Ulimate Oscillator because I need to sue IndicatorSetDouble function dynamically from OnCalculate. :) :)

When user changes inputs, OnInit is called, so there is not need to move these two lines into OnCalculate.
 
marketeer:
When user changes inputs, OnInit is called, so there is not need to move these two lines into OnCalculate.

very good point, marketeer.

However I need to calculate min and max value inside OnCalculate function.

So I can't avoid to use IndicatorSetDouble function inside OnCalcualte function.

The code is extremely simple and it is difficult to be wrong with code.

Also checked if min and max value is calculated correctly.

And they were correct.

So just curious if someone else is experiencing similar problem.

Maybe with IndicatorSetInteger function or IndicatorSetString function might have the same problem, I guess.

Kind regards.

 
FinanceEngineer:

very good point, marketeer.

However I need to calculate min and max value inside OnCalculate function.

So I can't avoid to use IndicatorSetDouble function inside OnCalcualte function.

The code is extremely simple and it is difficult to be wrong with code.

Also checked if min and max value is calculated correctly.

And they were correct.

So just curious if someone else is experiencing similar problem.

Maybe with IndicatorSetInteger function or IndicatorSetString function might have the same problem, I guess.

Kind regards.

Without further deatails about the code it's hard to tell if you're right. You've mentioned that the window scale depends from inputs. If this is the only dependency, you can move this part of code into oninit freely.

Also, if you set indicators minimum and maximum not on every tick but only on some rare conditions, you may try to call ChartRedraw after changing the sizes.

 
marketeer:

Without further deatails about the code it's hard to tell if you're right. You've mentioned that the window scale depends from inputs. If this is the only dependency, you can move this part of code into oninit freely.

Also, if you set indicators minimum and maximum not on every tick but only on some rare conditions, you may try to call ChartRedraw after changing the sizes.

Thanks. I at least got some temporary remedy. So I can go on. Later I will look for the real solution.

Kind regards.