Adding Custom Script colours for another Stock Code

Hi Guys,

 

I want to colour my candlesticks based on the some scripting on the non-charted XAO.

 

I found an example as below

 

V1 = GETDATA(CODE=XAO:ASX, TIMEFRAME=1 Month);
ROC(V1, BARS=1) > 0

 

but when I add to the Ichimoku function, it appears not to work?

WeekXAO = getdata(CODE=XAO:ASX, TIMEFRAME=1 Week, CURRENCY=AUD);

KS=ICHIMOKUCLOUD(WeekXAO).KijunLine;

 

Is this an issue with the function or is more syntax wrong?

 

Any ideas?

 

Thanks in advance

 

Steve

 

Hi Steve,

You don’t have a true/false condition for the custom colours to be determined. When do you want the bar colours to change?

In this example, the chart of CBA is orange when the XAO is trading above its 50 period moving average based on this script on the CBA chart:

V1 = GETDATA(CODE=XAO:ASX);

//Is XAO above its MA50?
V1 > MA(V1, BARS=50, CALC=Close)

As you can see, it matches the XAO and 50MA chart underneath:

Capture

Hi Darren,

 

Didn't add full code as I think/thought the issue is with the variable assignment in the Ichimoku.

Here's pretty much the full code. This script works fine when the XAO is the code being charted (minus the WeekXAO specification that is).

When I try and add as a bar custom colour for any other stock, it seems to be ignoring the XAO specification and just uses the stock code being charted at the time.

 

Steve

 

WeekXAO = getdata(CODE=XAO:ASX, TIMEFRAME=1 Week, CURRENCY=AUD);

TS=WeekXAO.ICHIMOKUCLOUD().TenkanLine;

KS=ICHIMOKUCLOUD(WeekXAO).KijunLine;

V1 = ICHIMOKUCLOUD(WeekXAO,DEFAULT=SenkouSpanA);

V2 = offset(V1[26],-26);

V3 = ICHIMOKUCLOUD(WeekXAO,DEFAULT=SenkouSpanB);

V4 = offset(V3[26],-26);

TradeGoCond1=TS > KS and KS>V2 and KS>V4;

TradeGo=TradeGoCond1

Hi Steven,

There is an error on the second line of your script, where the XAO data function has not been wrapped by the ICHIMOKUCLOUD() function. This would prevent the results from displaying correctly.

TS=WeekXAO.ICHIMOKUCLOUD().TenkanLine;

Please try adjusting the second line to work the same as the other lines in your script.

TS=ICHIMOKUCLOUD(WeekXAO).TenkanLine;

Sorry Matthew,

 

In my attempts to rectify/debug, this was one thing I tried but of course in sending it to you, again it was incomplete.

 

If you are confirming my reference to XAO data on charts displaying other stock codes should work, then I can have a more detailed play.

My initial findings seemed to suggest it didn't work - as per supplied screen shots.

I'll do a more simpler test. I'm sure it works for simple functions like ROC and VOL etc but with my past experiences with the Ichimoku function, I was wary that the issue was there.

I'll do further testing.

 

Thanks

 

Steve

Hi Guys,

 

Thanks for your assistance yet again. In further testing, I found it does work and my error in getting different results with the more complicated formula I was using was as a result of using the charted stocks close price and not the XAO's :-)

 

Thanks again

 

Steve