I tried to plot a zero line into the bottom part but it seemed that each indicator has it's own scale.
Is it possible to use two indicators with the same scaling and maybe add a third one as zero line?
Thanks
two indicators with same zero line
-
- Site Admin
- Posts: 278
- Joined: Mon Jun 11, 2018 11:44 am
- Has thanked: 2 times
- Been thanked: 31 times
Re: two indicators with same zero line
You can apply same scale to multiple indicators by adding those to same AxisGroup object (just create an object and add both indicators to it).
-
- Posts: 67
- Joined: Thu Nov 01, 2018 1:50 pm
- Has thanked: 38 times
- Been thanked: 9 times
Re: two indicators with same zero line
Hi mdtrader,
Please can you post some sample code to draw the zero line in the same scale as the Indicator
Basically, on the QuotesDelta indicator I want to draw a LOWER and UPPER line(as on a oscillator like RSI, MACD etc) and also a zero line. Maybe in the future, also create an alert when the indicator crosses above the UPPER line(or belowthe LOWER line).
TIA
Regards,
SDG
Please can you post some sample code to draw the zero line in the same scale as the Indicator
Basically, on the QuotesDelta indicator I want to draw a LOWER and UPPER line(as on a oscillator like RSI, MACD etc) and also a zero line. Maybe in the future, also create an alert when the indicator crosses above the UPPER line(or belowthe LOWER line).
TIA
Regards,
SDG
-
- Posts: 39
- Joined: Sat Oct 27, 2018 4:05 pm
- Location: germany
- Has thanked: 12 times
- Been thanked: 41 times
Re: two indicators with same zero line
sorry for the delay... here's my solution:
Code: Select all
protected Indicator indicator1;
protected Indicator indicator2;
protected Indicator zero;
AxisGroup grpAxis;
AxisRules rulesAxisRules;
// when within the initialize method:
grpAxis = new AxisGroup();
grpAxis.add(indicator1);
grpAxis.add(indicator2);
grpAxis.add(zero);
rulesAxisRules= new AxisRules();
rulesAxisRules.setForcedMax(250);
rulesAxisRules.setForcedMin(-250);
rulesAxisRules.setSymmetrical(true);
grpAxis.setAxisRules(rulesAxisRules);
// for the zero line within the onInterval method:
zero.addPoint(0);