Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I am trying to code a quick indicator which will write out some text on each incoming tick. I'm on a 333 tick chart, just crossed over the swing indicator, and I want to write a line of HTML for each high and each low from the entry. I'm just trying to get some simple stats about risk:reward.
For hours I've been struggling and suddenly realized my code is fine. I think there is something wrong with "COBC = false" in NT7 beta 20, because my simple indicator is only called on the first tick of the bar.
I went back to the drawing board and wrote the simplest possible indicator, just to dumb things down and test. Guess what....
The output says...
TICK 1
TICK 1
TICK 1
TICK 1
TICK 1
TICK 1
TICK 1
Can you help answer these questions from other members on NexusFi?
Historical charts and backtesting are incapable of COBC = false. It is a design limitation.
COBC = false is only available on live incoming data. So make sure your test is live incoming data in a moving market, and not based on adding the indicator to a chart --- at which point it is historical data only.
Thanks Mike. This explains what I was seeing then. I added another timeframe (single tick), and this seems to have fixed my problem. Of course my code is now much more complex than the simple HTML-generating indicator that I envisioned, but it's working for the most part.
""Historical charts and backtesting are incapable of COBC = true""
I think I am confused: this is from the NT7 f1 help:
If true, OnBarUpdate() is called on the close of each bar otherwise it is called on each incoming tick. This property should ONLY be set in an Initialize() method and be the last statement within that method.
· When indicators or strategies are running on historical data, OnBarUpdate() is only called on the close of each historical bar even if this property is set to false. This is due to the fact that with a historical data set, only the OHLCVT of the bar is known and not each tick that made up the bar.
· The CalculateOnBarClose property of indicators embedded within a strategy are overriden by the CalculateOnBarClose property of the strategy
Doesnt this mean that COBC=true is only workable option in backtesting/historical charts?
Doesnt this mean that COBC=true is only workable option in backtesting/historical charts?
Jon
I am no expert at this. I am a software developer with over 10 years experience, so my coding skills are fine, but NT has a bit of a learning curve.
I found a workaround and was able to get my indicator to be called for each incoming tick, but I had to add a 1-tick timeframe to my indicator. This means that you will have to reference price in a different way throughout your indicator. Instead of High[0] you will use Highs[0][0]. The first series of the array refers to which timeframe.
For me, I want to check for a crossover with each incoming tick, so I use this...
//CROSSOVER HIT!
if (Closes[1][0] < (SMA(BarsArray[0],12)[0]-.2) && !bLongFirstIn && bLongSignalHit){
This means the 1-tick dataset crosses the 333 tick SMA(12). Hope that helps. There are other examples, but I will tell you it's a pain once you commit to multiple timeframes. Everything you code becomes more complex.
The following 3 users say Thank You to Curbfeeler for this post: