NexusFi: Find Your Edge


Home Menu

 





Indicator vs strategy discrepancy


Discussion in TradeStation

Updated
    1. trending_up 1,752 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 bluefightingcat 
Espoo Finland
 
Experience: Intermediate
Platform: TradingBlox, Tradestation
Trading: Stocks
Posts: 41 since Sep 2015
Thanks Given: 2
Thanks Received: 10

Ok so I have an indicator plotted on my chart. I have the very same indicator code inserted as part of my strategy. However to my dismay I discovered that the values between the indicator and the strategy are slightly off. It seems that the indicator is calculated differently compared to when the exact same code is part of a strategy.

What could be causing this and is there a solution?

Here is the indicator code:

 
Code
Inputs: iLenRSI(3), iLenUP(2), iLenROC(100);

Var: vUpArray(0), vDownArray(0), vUpDown(0), vCRSI(0);

vUpArray = MRO(C<=C[1],100,1);
vDownArray = MRO(C>=C[1],100,1);
vUpDown = IFF(C=C[1], 0, IFF(vUpArray>0,vUpArray,-vDownArray));

vCRSI = (RSI(C,iLenRSI) + RSI(vUpDown, iLenUP) +
100*PercentRank(RateOfChange(C,1),RateOfChange(C,1),iLenROC+1))/3;

Plot1(vCRSI, "CRSI");


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
Trump Truth Social Fires Hormuz From 10% to 59% -- Arsen …
Prediction Markets & Event Contracts
Warsh Opens Today, Hormuz June 19 -- WTI Below $80, Fran …
Prediction Markets & Event Contracts
No book, only a stair: journaling fills where price move …
Cryptocurrency
Four New E-mini Futures Launch June 29 -- Russell 3000, …
Emini and Emicro Index
 
  #2 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,738 since Jul 2012
Thanks Given: 1,918
Thanks Received: 7,487


bluefightingcat View Post
Ok so I have an indicator plotted on my chart. I have the very same indicator code inserted as part of my strategy. However to my dismay I discovered that the values between the indicator and the strategy are slightly off. It seems that the indicator is calculated differently compared to when the exact same code is part of a strategy.

What could be causing this and is there a solution?

Here is the indicator code:

 
Code
Inputs: iLenRSI(3), iLenUP(2), iLenROC(100);

Var: vUpArray(0), vDownArray(0), vUpDown(0), vCRSI(0);

vUpArray = MRO(C<=C[1],100,1);
vDownArray = MRO(C>=C[1],100,1);
vUpDown = IFF(C=C[1], 0, IFF(vUpArray>0,vUpArray,-vDownArray));

vCRSI = (RSI(C,iLenRSI) + RSI(vUpDown, iLenUP) +
100*PercentRank(RateOfChange(C,1),RateOfChange(C,1),iLenROC+1))/3;

Plot1(vCRSI, "CRSI");


Make sure the lookback length (MaxBarsBack) is set to the same. Strategy default is 50, you can change it. Indicators have "auto detect" as default, you can change it.

Make both the same value.


Follow me on X Reply With Quote
Thanked by:
  #3 (permalink)
 bluefightingcat 
Espoo Finland
 
Experience: Intermediate
Platform: TradingBlox, Tradestation
Trading: Stocks
Posts: 41 since Sep 2015
Thanks Given: 2
Thanks Received: 10



kevinkdog View Post
Make sure the lookback length (MaxBarsBack) is set to the same. Strategy default is 50, you can change it. Indicators have "auto detect" as default, you can change it.

Make both the same value.

I tried that. Unfortunately it didn't help.

I'm using two different symbols in the strategy. I did some testing and it seems to me that the problem arises when I update the code of the indicator in the strategy to reference "Data2".
In theory there shouldn't be any discrepancy because when comparing the strategy with the indicator code, with the indicator one a single data stream, everything works fine.

So I suspect there is something wrong with my code when I try and use Data2 on the indicator.


Started this thread Reply With Quote
  #4 (permalink)
 bluefightingcat 
Espoo Finland
 
Experience: Intermediate
Platform: TradingBlox, Tradestation
Trading: Stocks
Posts: 41 since Sep 2015
Thanks Given: 2
Thanks Received: 10

I found my mistake. It was a typo in my code.


Started this thread Reply With Quote




Last Updated on March 21, 2023


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts