Login Page - Create Account

Support Board


Date/Time: Fri, 22 Nov 2024 08:56:50 +0000



[User Discussion] - Custom study syntax help needed

View Count: 1905

[2013-04-27 00:48:27]
User22396 - Posts: 191
Going way out on a limb here in tryin to modify some of Kiwi's older code for the AverageRange study from kiwi8.cpp...thanks kiwi!

Tryin to find the 'Minimum' of these 2 expressions...

A) sg.Subgraph[2]=sg.BaseDataIn[SC_HIGH][i-j]-sg.BaseDataIn[SC_OPEN][i-j]
B) sg.Subgraph[2]=sg.BaseDataIn[SC_OPEN][i-j]-sg.BaseDataIn[SC_LOW][i-j]

In a spreadsheet study would just be Min(a,b) so wasn't sure if it that easy to re-code? somehow I do not think so lol

I was able to create 2 new studies using A OR B above and compile with no errors but not sure how to find the minimum of both expressions in just one study

Thanks
B

Date Time Of Last Edit: 2013-04-27 00:48:45
[2013-04-27 01:13:03]
User22396 - Posts: 191
would this work?

if(sg.BaseDataIn[SC_HIGH][i-j]-sg.BaseDataIn[SC_OPEN][i-j]> sg.BaseDataIn[SC_OPEN][i-j]-sg.BaseDataIn[SC_LOW][i-j]) = sg.Subgraph[2]=sg.BaseDataIn[SC_OPEN][i-j]-sg.BaseDataIn[SC_LOW][i-j]; else
sg.Subgraph[2]=sg.BaseDataIn[SC_HIGH][i-j]-sg.BaseDataIn[SC_OPEN][i-j];


[2013-04-27 01:29:22]
ejtrader - Posts: 688
Don't know what exactly you are trying to do - but you can try this and see:

sg.Subgraph[2][i]=min( (sg.BaseDataIn[SC_HIGH][i-j]-sg.BaseDataIn[SC_OPEN][i-j]), (sg.BaseDataIn[SC_OPEN][i-j]-sg.BaseDataIn[SC_LOW][i-j]) );

Date Time Of Last Edit: 2013-04-27 01:30:13
[2013-04-27 03:11:12]
User22396 - Posts: 191
Thanks ejtrader!...compiled fine...goin check to see if outputting correctly

I am trying to recreate an indicator I have used in NT7 that plots the AverageDailyNoise (i.e. 10day sma of ADN etc) as bands around an 'Open' price (i.e. globex or pit etc)...similar to OR breakout

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account