# Scaling of two indicators in one subplot  [SOLVED]

Questions about MultiCharts and user contributed studies.
javamarket
Posts: 55
Joined: 10 Jul 2014
Has thanked: 10 times
Been thanked: 18 times

### Scaling of two indicators in one subplot

Hello all and thanks for any assistance ...

I have an indicator I've used for years that I'm fond of. It has two parts, a primary range plotter and a fib overlay. When I apply this set on a subplot the scaling of the two seems inconsistent. Perhaps I'm missing something basic but I believe there may be an anomaly here. Can anyone else confirm the discrepancy? Code follows:

eKamWhere

Code: Select all

```{ how big is today's range, and where are we in that range? } input: Comment(""); var: dayRange(0),hi(0),lo(0), p1(0.382),p2(0.5),p3(0.618),p4(0.786), bottom(0),top(0),it(0); hi = HighD(0); lo = LowD(0); dayRange = hi - lo; top = dayRange/2; bottom = -top; it = bottom + c - lo; plot1(bottom,"range bottom"); plot2(top, "range top"); plot3(0, "range middle"); var: color(yellow); if it>it[1] then color=green; if it<it[1] then color=red; plot4(it,"now",color); plot4[1](it[1],"now",color); ```
eKamWhereFib

Code: Select all

```{ plot fib levels within today's range } input: fib1(0.214), fib2(0.382), fib3(0.618), fib4(0.786); var: dayRange(0),hi(0),lo(0), bottom(0),top(0); hi = HighD(0); lo = LowD(0); dayRange = hi - lo; top = dayRange/2; bottom = -top; plot1(bottom + dayRange*fib1, "fib1"); plot2(bottom + dayRange*fib2, "fib2"); plot3(bottom + dayRange*fib3, "fib3"); plot4(bottom + dayRange*fib4, "fib4"); ```
To recreate, I plot this on an @ES and both components are set to 'Same as instrument'. If you'll hover with the cursor and read the data box you should see that the value of one set no longer matches the shared scaling labels of the Y-axis.
Last edited by javamarket on 11 Aug 2014, edited 1 time in total.

SP
Posts: 453
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 283 times

### Re: Scaling of two indicators in one subplot

The easiest way is to combine the two codes into one single code.

Code: Select all

``` { how big is today's range, and where are we in that range? } input: fib1(0.214), fib2(0.382), fib3(0.618), fib4(0.786); var: dayRange(0),hi(0),lo(0), bottom(0),top(0),it(0),color(yellow); hi = HighD(0); lo = LowD(0); dayRange = hi - lo; top = dayRange/2; bottom = -top; it = bottom + c - lo; plot1(bottom,"range bottom",green); plot2(top, "range top",red); plot3(0, "range middle",white); if it>it[1] then color=green; if it<it[1] then color=red; plot4(it,"now",color); plot4[1](it[1],"now",color); plot11(bottom + dayRange*fib1, "fib1",darkgreen); plot12(bottom + dayRange*fib2, "fib2",cyan); plot13(bottom + dayRange*fib3, "fib3",magenta); plot14(bottom + dayRange*fib4, "fib4",darkred); ```

javamarket
Posts: 55
Joined: 10 Jul 2014
Has thanked: 10 times
Been thanked: 18 times

### Re: Scaling of two indicators in one subplot

Hi @SB and thank you. I agree merging the constructs sorts it.

The main reason for posting was to perhaps ID a bug.

That said I do appreciate you taking the time to reply and post.

Mark

Henry MultiСharts
Posts: 9083
Joined: 25 Aug 2011
Has thanked: 1258 times
Been thanked: 2920 times

### Re: Scaling of two indicators in one subplot  [SOLVED]

Hello javamarket,

Since MultiCharts 9.0 Beta 1 multiple indicators plotted on the same subchart all set to "same as instrument" scaling have a single "same as instrument" Y-price axis. With such setup in order to change the indicator Y-price axis you need to drag the instrument's Y-price axis.

javamarket
Posts: 55
Joined: 10 Jul 2014
Has thanked: 10 times
Been thanked: 18 times

### Re: Scaling of two indicators in one subplot

Hi Henry,

Thank you for the information. I look forward to this change when out of beta.
Basis your description it will solve this.

Mark