OmniTrader Professional Forum OmniTrader Professional Forum
forums calendars search
today this week
 
register logon control panel Forum Rules
You are currently browsing as a guest.
You should logon to access more features
A Self-Moderated Community - ALL MEMBERS, PLEASE READ!
Vote for Members who contribute the most to your trading, and help us moderate content within the Forums.


  Current location        Thread information  
OmniTrader Professional Forum
Feature Requests
Please add "viewbars" param to everything
Last Activity 12/18/2017 4:46 AM
7 replies, 894 viewings

Jump to page : 1
Now viewing page 1 [25 messages per page]
 
back reply
Printer friendly version

^ Top
Curtis

Legend
1001001001002525
Posts: 460

Joined: 1/4/2009
Location: San Diego, CA

User Profile
 
Subject : Please add "viewbars" param to everything
Posted : 3/31/2015 7:36 AM
Post #23387

I request that all indicators (and systems for that matter) that Nirvana produces have a "viewbars" param. All of the OL code that I write, such as it is, has this "viewbars" param setting built into the code so that I can have the indicator show for all bars (0), or the specific number of bars that are specified. (I apologize to whomever came up with this idea first for not giving you credit - I learned the trick from Jim Dean I think).

When I'm trading in real time, I try to make my charts as fast as possible. So I'll have a version of the chart that is "fast" or "fewbars". This is really helpful in the morning during the first hour of trading to keep my system from lagging. Also as the day wears on, the system can become sluggish with all the stuff being shown back to the first bar. There are points during the day I want to see the history, but most of the time, I'm looking at the HRE and a couple hundred bars of info being displayed. On my "fast charts", everything is limited except Nirvana's indicators which go back to the first bar of the chart.

All of my indicators and systems can be limited to number of bars processed except Nirvana's indicators/systems.

Your "viewbars" code should include a warm-up routine that does not allow the indicator to be seen until an appropriate warm-up has been completed to allow the indicator to be accurate from the very first time that the indicator/system is visible to the user. I can't stress the importance of this point (in this paragraph) enough.

Every indicator and system that Nirvana produces should have the "viewbars" param. This should be SOP.

Thanks for considering this idea,
Curtis

[Edited by Curtis on 3/31/2015 7:46 AM]

^ Top
Jim Dean

Sage
20001000100
Posts: 3122

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Please add "viewbars" param to everything
Posted : 3/31/2015 9:57 AM
Post #23388 - In reply to #23387

I fully agree. I've promoted these two concepts (warmup and viewbars) extensively. I realize that it takes a lot of work for some kinds of calculations to determine and implement efficient warmup calcs (oft-times it is "tiered" with staggered warmups as the calc progresses), but the benefits are potentially huge (10x or more speedup).

The most notable benefit accrues when the Indicator is used in a custom FL column, or for an EZ Setup routine ... both of those only report the info about ONE bar, so all the other bars (and, esp with intraday, there may be many thousands loaded).

I've implemented this in hundreds of routines, some of them several thousand lines long, so I have a *lot* of experience with the easy and hard ways to do this. Nirvana, please contact me if you'd like suggestions for the proper architecture, or assistance with the conversion project.

Specifically:

1. Some kind of "Viewbars" input that limits not just plotting but calculation of final output to anything from just one bar, to the max possible given the bars loaded. This controls the "window size" of the output.

2. Some kind of "LeftShift" routine that causes the output calcs to STOP before the HRE, via a "bars-ago" kind of input. I often combine these two into a single "Window.Shift" input (WWWW.SSS = #bars for each)

3. Warmup calc's are poorly understood by the industry as a whole. Obviously if you have an Nbar lookback in your calc's, you should wait to start the calc's at least N bars. HHV, LLV, SMA and WMA are also similarly simple, since they are "bounded" calc's. The trouble arises when any calc is done with an "infinite series" ... EMA, ATR(Wilders smoothing), MACD, or any calc that uses EMA etc internally for smoothing (including all of Ehlers' fancy stuff). This encompasses a huge number of indicators. Rough rule of thumb for pure EMA: you need N-times the EMA periods as warmup, for every significant figure of accuracy in the result. So if you want the nearest penny in a $300.00 stock, than means a 20-bar EMA needs 5x20=100 bars warmup, before the calc is "stabilized". Wilders smoothing is much slower than EMA ... roughly double the warmup of EMA. And so on. This must be empirically determined for each calc. It's timeconsuming to figure out, but very important, especially when for efficiency's sake your output is limited to one bar.

4. Yet another important factor for some kinds of calcs (notably ALL NTB's and even HA's to some degree) is implementation of an input "reference bar" in YyMmDd form, so that the "bricks" can be stable as time goes on. I've written a lot about this elsewhere ... I've also created full solutions to the problem. So, let me know if you need help. It's not simple to deal with.

Curtis ... I applaud your making this request, but honestly, it's a huge task as I'm sure you recognize. Hopefully once the OVest dust settles, and there is time for N to refocus on OT, this will be one of the things on the list.

[Edited by Jim Dean on 3/31/2015 10:02 AM]

^ Top
Xaiver Comelli

Member
25
Posts: 28

Joined: 11/15/2008
Location: Raleigh, NC

User Profile
 
Subject : RE: Please add "viewbars" param to everything
Posted : 3/29/2016 6:52 PM
Post #25067 - In reply to #23387

Viewbars sounds like a smart ideal to limit the number of bars when plotting an indicator, and above all, when inserting an indicator in the focus list (which sometime I feel slows everything down)...

Now, the import question: how do I wright a line that limits the total number of bars...? :D

Thanks,


^ Top
Jim Dean

Sage
20001000100
Posts: 3122

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Please add "viewbars" param to everything
Posted : 3/29/2016 8:25 PM
Post #25068 - In reply to #25067

It's not just one line, if you're trying for meaningful speed up. It's non-trivial coding. There are several examples of it on the TrradeTight forum. N time now to find them for you.
^ Top
Xaiver Comelli

Member
25
Posts: 28

Joined: 11/15/2008
Location: Raleigh, NC

User Profile
 
Subject : RE: Please add "viewbars" param to everything
Posted : 3/30/2016 8:24 PM
Post #25069 - In reply to #23387

Jim, I found one of your post from back in 2008! and adjusted to this indicator I am working on... it seems to work, but I don't know if the way I incorporated it is the most efficient way... a short feedback would be appreciated!!!


#Indicator

#Param "Periods" , 90
#Param "Bars2startCalcAtB4current", 5, 5, 1000

Dim myStdDev As Single
Dim myLnRegSlope As Single
Dim myMultiplier As Single
Dim myR As Single
Dim myRR As Single
Dim Price, Show As Single


Show = 0
Price = c
If bar < Price.Length-1 - Bars2startCalcAtB4current Then Return 0
If bar > Price.Length-1 - 0 Then Return 0
Show = c


myMultiplier = SQRT((Periods+1)*(Periods-1)/12)
myLnRegSlope = LNREG_SLOPE(Periods)
myStdDev = STD(Periods)

If myStdDev > 0 Then
myR = myMultiplier*myLnRegSlope/myStdDev
myRR = Round(myR*myR*round((((1+LinearRegressionSlope(Periods)/C)^250)-1)*100))
Else
myR = 0
myRR = 0
End If



' Plot R^2 in its own pane (values always between 0 and 1)

Plot("RSquared", myRR)

' Return the value calculated by the indicator
Return myRR



^ Top
Jim Dean

Sage
20001000100
Posts: 3122

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Please add "viewbars" param to everything
Posted : 3/30/2016 8:58 PM
Post #25070 - In reply to #25069

This code structure is much different than the approach that I normally take. I use it then else end if, and 99% of the time use only one Return statement at the end. I do all prep calculations during bar=0 (including determination of warmup). Then there's usually a section where warmup calcs are done but not output, and a section where bar >= warmup, where the final calcs and output (plot or return) is done.

I've learned that an orderly and structured pattern is important, since the OLang parser sometimes does odd things otherwise.

You'll see many examples of this structure in the TradeTight forum. If you want to have help more specific than this, please register as a free participant and post about it there, so that I can keep things organized for future accessibility.

[Edited by Jim Dean on 3/30/2016 8:59 PM]

^ Top
Jim Dean

Sage
20001000100
Posts: 3122

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Please add "viewbars" param to everything
Posted : 3/30/2016 9:05 PM
Post #25071 - In reply to #25070

Pursuant to those comments - to control what bars are calc'd requires extra prep work in the bar=0 section, to determine the proper start point bar to being warmup calcs, and the initial output bar to begin plot/return, and also a "lastbar" to stop the calcs before the HRE if that is desired. This can provide dramatic improvements in speed in some cases.

More complex routines often will require several intermediate if then bar= thresholds since the warmup is "staged" in those cases. If you really want to speed things up a lot, then you need to replace OT function calls such as HHV and SMA and STDEV with manual iterative coding - that's very complex sometimes. But very effective.

Doing this all can make a program that only takes 50 lines of code to do things correctly but inefficiently change into a program that runs 10x faster but also has 10x more lines of code.
^ Top
Xaiver Comelli

Member
25
Posts: 28

Joined: 11/15/2008
Location: Raleigh, NC

User Profile
 
Subject : RE: Please add "viewbars" param to everything
Posted : 3/31/2016 8:03 PM
Post #25072 - In reply to #23387

thanks for the explanation, Jim. On my own coding ignorance, I always thought the longer the code, the slower. Your experience says otherwise, and it make sense. This explains why my little mean-reversion systems using STD is so lowwww...

I'll join your group...


Jump to page : 1
Now viewing page 1 [25 messages per page]
back reply

Legend    Action      Notification  
Administrator
Forum Moderator
Registered User
Unregistered User
E-Mail this thread to a friend
Toggle e-mail notification


Nirvana Systems
For any problems or issues please contact our Webmaster at webmaster@nirvsys.com.