NexusFi: Find Your Edge


Home Menu

 





Shifting Values within a Variable


Discussion in TradeStation

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




 
Search this Thread

Shifting Values within a Variable

  #1 (permalink)
trader0311
Wheeling, WV USA
 
Posts: 1 since Feb 2015
Thanks Given: 0
Thanks Received: 0

Hi,

I have a variable that is conditional meaning that sometimes values are calculated for the variable and sometimes they are not depending on if my condition is true. When the condition is not true generally the last value that the variable produced is used over and over until the condition is true and another value is added (or I can add in a zero). To illustrate please see the string of numbers below:

1, 2, 3, 4, 5, 5, 5, 5, 5, 6, 7, 8

As you can see in this string the number 5 is repeated. The problem I am facing is that I want to apply an analysis technique, like a moving average, to this string of numbers contained in a variable. The consecutive 5's will screw up the analysis technique you apply because of this "flat spot" (ie the consecutive 5's).

My question related as to how I eliminate these redundant numbers or flat spots so I can properly apply different analysis techniques or functions to the variable. When done properly the string of numbers would read 1,2,3,4,5,6,7,8.

Ideally I would like to do this within a variable since arrays can be difficult to apply analysis techniques to. I had the idea of shifting all the values in the variable to the right by one bar when my condition was not true. If that was possible, the shift in the numbers would eliminate this gap of redundant numbers in my string. Would anyone have an idea regarding how I can accomplish this shift in the variable values using easylanguage? Any insight would be greatly appreciated. This has had me stumped for the longest time.

Reply With Quote




Last Updated on September 20, 2015


© 2024 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 - Privacy Policy - Downloads - Top
no new posts