Page 1 of 1

Error - Bars reference value: -1 for strategy NT

Posted: May 30 2007
by fox
I am trying to run a strategy that I create in Multicharts and send it to NT using the eld/els scripts designed for TS. It was successful just using regular easylanguage code to buy at market, sell, short, buytocover but when I substitute these commands with NT commands NTBuyMarket, NTSellMarket and NTClosePosition I get the following error when loading the charts: "Trying access to data at future. Bars reference value: -1". Here is a paste of the command I wrote for a long entry (basic ma cross):

ifNTConnected(1)andLastBarOnChartthenbegin
ifclose crosses above mathenNTBuyMarket("",1)nextbar;
end;

Posted: May 31 2007
by Januson
I know that NT will fail if you dont check for the barnumber. MC doesn't fail if you try to calculate at a non existing barnumber.

I suggest you do something like this:
if (CurrentBar == 1)....

CurrentBar is NT-language

Hopefully this solve it...

Besides that, I'm a bit curious, how do you send something from MC to NT. I was starting to translate my indicators written in Easylanguage to NT, an awfull exercise - I gave up :(
I need to take the indicatorvalues from MC and feed into NT's MarketAnalyzer, do you have any good suggestion?

Kind regards
Januson

Posted: Jun 03 2007
by fox
Januson,

Thanks for the suggestion. I tried it but it doesn't work either. I have "if last bar on chart" which I believe may be equivalent but neither work. When I cut and paste the example code from the NT website I do not get this error so I'm sure its coming from somewhere in the function itself (although I'd think the only thing that should be affected are the actual NT strategy commands). I posted on NT board but the moderator said he is not familiar enough with MC. I explained that is was very similar to TS and made by them. The code is essentially easy language.

As for your question unfortunately I'm not sure at all how you'd pass indicator values on to NT's market analyzer. I've never used the analyzer either so I'm unfamiliar. I'll be sure to post back if I find out anything from either situation.

Thanks

Posted: Jun 03 2007
by Guest
I am curious if this works for you. I don't use NJ but I had something similar happen to me with my own strategy and this fixed the problem:

1) Right-Click on the Chart
2) Select "Format Window"
3) Click on the "X - Time Scale" tab
4) Change "Space to the Right" to
5) Click OK
6) Try enabling your strategy - you may have to keep increasing the number if you get another error message.