View Full Version : DrawText in Strategy
ATI user
10-26-2009, 08:44 AM
Please remind me what was to change in NT7 re draw objects from a strategy.
Remember 6.5 had a dummy indicator that was used to do this?....which maybe we called from the strat?
Can not remember
thanks
NinjaTrader_Josh
10-26-2009, 09:03 AM
ATI user,
Not sure what you mean by DrawText. DrawText has always worked in a strategy or indicator and will continue to work.
If you mean plots, that would be the StrategyPlot reference sample. Though that was always more of a workaround with limitations. Strategies are generally not meant for plotting. If you want to plot you should use an indicator.
ATI user
10-26-2009, 09:30 AM
thanks....yes that was plots.....of course....my 6.5 strats used DrawText a lot
confusion comes from this strat code:
//from NT7 indicator
DrawText("tag", false, "TEXT" , 0, 10010,0, Color.Red,
new Font("Arial",20), StringAlignment.Far, Color.Transparent, Color.Black,0);
// from NT7 help guide
DrawText("tag1", "Text to draw", 0, 10005, Color.Red);
//from NT7 indicator DrawHorizontalLine("tag2",false,10000,Color.Cyan,DashStyle.DashDotDot,5);
Of the 3 lines of code, only the line plots....not even DrawText from NT7 help guide worked
this is on a blank chart with only the strat running
NinjaTrader_Josh
10-26-2009, 09:36 AM
Suggest you check Control Center logs for errors.
ATI user
10-26-2009, 09:54 AM
always look there first
no errors in Log
no errors in Output Window
draws line...will not draw text
NinjaTrader_Josh
10-26-2009, 10:27 AM
Seems to work here. Please try the attached indicator on your machine. Also, please be sure you are on NT7B3 now. Thanks.
ATI user
10-26-2009, 11:03 AM
same issue in b3
will try your test strat
ATI user
10-26-2009, 11:06 AM
Josh
You exported an Indicator. I am having problem with DrawText in a Strategy
Yours plots fine as ind....so do mine
only horizontal line plots from my strat code plots...no text
..................
put your drawtext line of code in my strategy and also would not draw text
//////////
all 4 lines (3 of mine, 1 of yours) plots fine in an ind.....only line plots in strat
..
ATI user
10-26-2009, 11:25 AM
Josh
To reproduce at your end:
add your DrawText code to your SampleAtmStrategy
and run it
that is what I get from doing same
the 'BarsDisplayText' error is a bug Dierk has solved for NT7b4....maybe they are related
ATI user
10-26-2009, 11:47 AM
simplest way to reproduce
go to Wizard....create a new Strategy....add only your line of DrawText code
compile, load to chart and enable ....no text
this proves bug is not related to AtmStrategyCreate issue Dierk is working on
NinjaTrader_Josh
10-26-2009, 02:00 PM
Seems to be working here. Please try attached strategy.
ATI user
10-26-2009, 05:15 PM
not working here
I did a complete install of beta 3....no difference
ATI user
10-27-2009, 06:23 AM
added horizontal line to your strat to show it plots
still no text
NinjaTrader_Josh
10-27-2009, 08:35 AM
I am not sure why it would not show up for you as it shows up on my end. Perhaps try reinstalling .NET?
NinjaTrader_Dierk
10-27-2009, 09:03 AM
Guessing: may be you have issues with fonts on your machine. Josh's sample went with Arial,10. You could try different fonts to see if that would make any difference.
ATI user
10-27-2009, 09:56 AM
I am not sure why it would not show up for you as it shows up on my end. Perhaps try reinstalling .NET?
I am running .NET Framework 3.5 SP1
is that the correct version?
NinjaTrader_Josh
10-27-2009, 10:23 AM
That version should be fine.
ATI user
10-27-2009, 11:58 AM
Josh, Dierk
This is interesting
I exported 32 bit protected from desktop and imported to my laptop...remotesoft worked fine.
I forgot to create my atmstrategy for my strategy and therefore got the typical error message.
The interesting part is that Text now plotted from my strat on the chart.
I then created the atmstrategy and ran the strat....no text on chart this time, only horizontal line
And now, of course, I got the error message from trying to place an order using atmstrategycreate.....i.e. that Dierk has fixed for beta 4....re BarDisplayText error
Conclusion: unable to draw text on chart from strat is directly related to same issue
to reproduce: put the DrawText line in SampleAtmStrategy.....run it without creating the atmstrategytemplate....text will draw... then create the atmstrategytemplate and text will not draw and you should get the BarsDisplayText error
....
BTW....neither laptop nor desktop will run my strat on a second chart....only minute charts
ATI user
10-27-2009, 01:13 PM
correction
beta 3 on my laptop XP does draw the text with the atm template in place
and the same strat on one of my user's Windows 7 machine it draws the text also
so problem is only on my Vista machine
all 3 machines are using .NET 3.5 and zenfire
will try to re-install .net on my desktop
jdfagan
11-13-2009, 05:23 PM
If you mean plots, that would be the StrategyPlot reference sample. Though that was always more of a workaround with limitations. Strategies are generally not meant for plotting. If you want to plot you should use an indicator.
Josh,
I made heavy use of StrategyPlot with 6.5 due to some data I needed plotting that is intimately tied with calculations specific to a strategy - not really indicator material.
I'm going thru the list of Code-Breaking Changes for NT 7 and was wondering about StrategyPlot's use of DataSeries since a couple of issues regarding DataSeries is mentioned in changes, notably:
* default of 256 lookback
* calling DataSeries.Set() before accessing a DataSeries value on a bar
Does StrategyPlot need any alteration do you think with regard to how it uses DataSeries for it to work comparably to how it did in 6.5? I didn't notice any .Set method calls in StrategyPlot so was concerned about that.
Thanks for any pointers..
JD
NinjaTrader_Josh
11-16-2009, 08:52 AM
JD,
I imagine you should be able to get it to perform the same.
The .Sets for the StrategyPlot are seen here:
StrategyPlot(0).Value.Set(High[0]);
StrategyPlot(1).Value.Set(Highs[1][0]);