NexusFi: Find Your Edge


Home Menu

 





Help my indicator plot on last bar


Discussion in TradeStation

Updated
    1. trending_up 4,310 views
    2. thumb_up 8 thanks given
    3. group 3 followers
    1. forum 11 posts
    2. attach_file 3 attachments




 
Search this Thread

Help my indicator plot on last bar

  #1 (permalink)
 
GoldenRatio's Avatar
 GoldenRatio 
Philadelphia, PA
 
Experience: Advanced
Platform: Matlab, TradeStation
Trading: Stocks
Posts: 211 since Aug 2012
Thanks Given: 5,192
Thanks Received: 296

Can somebody please tell me why my indicator is not plotting on the last bar?

For example, I would have expected a blue arrow to be plotted over the last bar as all the conditions are met?

I checked the scale range and it is set to "Expand Range to include Analysis Techniques" so it shouldn't be off the screen. Any ideas?



Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
How to apply profiles
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
34 thanks
Just another trading journal: PA, Wyckoff & Trends
30 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628

GoldenRatio,

can you post the code in a code box? Also what chart symbol and chart setting did you use, so someone can reproduce it?
Is update intrabar checked or unchecked for your indicator?

Regards,
ABCTG


GoldenRatio View Post
Can somebody please tell me why my indicator is not plotting on the last bar?

For example, I would have expected a blue arrow to be plotted over the last bar as all the conditions are met?

I checked the scale range and it is set to "Expand Range to include Analysis Techniques" so it shouldn't be off the screen. Any ideas?




Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
 
GoldenRatio's Avatar
 GoldenRatio 
Philadelphia, PA
 
Experience: Advanced
Platform: Matlab, TradeStation
Trading: Stocks
Posts: 211 since Aug 2012
Thanks Given: 5,192
Thanks Received: 296


ABCTG, thanks for offering to help!

Yes update intrabar is checked. I am not sure what you mean when you ask "what chart symbol and chart setting did you use" as I am still earning the language and program.

 
Code
Using elsystem;
Using elsystem.drawing;
Using elsystem.drawingobjects;

Inputs:
	FontName("TradeStation"),
	UpChar("Q"),
	DnChar("A");
	
Vars:
	Font LabelFont(Null),
	TextLabel UpLabel(Null),
	TextLabel DnLabel(Null),
	SMA10Volume(0),
	Stock_Range(0);
	
SMA10Volume = Average(Volume,10);
Stock_Range = (Close-Low)/(High-Low);	

Once Begin
	LabelFont = Font.Create(FontName, 12);
End;
      
if Volume > SMA10Volume AND Close > Close[1] AND Stock_Range >= 0.50 then
Begin
	UpLabel = TextLabel.Create(DTPoint.Create(Bardatetime[0], High+3), UpChar);
	UpLabel.Font = LabelFont;
	UpLabel.HStyle = HorizontalStyle.center;
	UpLabel.VStyle = VerticalStyle.center;
	UpLabel.Color = color.Blue;
	DrawingObjects.Add(UpLabel);
End;

Started this thread Reply With Quote
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628

I meant the symbol and bar interval settings that you used for the chart where your arrow should have appeared on the last bar.
It seems to be a daily chart, but what is the symbol?

Regards,
ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #5 (permalink)
 
GoldenRatio's Avatar
 GoldenRatio 
Philadelphia, PA
 
Experience: Advanced
Platform: Matlab, TradeStation
Trading: Stocks
Posts: 211 since Aug 2012
Thanks Given: 5,192
Thanks Received: 296


ABCTG View Post
I meant the symbol and bar interval settings that you used for the chart where your arrow should have appeared on the last bar.
It seems to be a daily chart, but what is the symbol?

Regards,
ABCTG

Symbol should be blue up arrow. I want it to run on both the daily and weekly chart time frames.

Started this thread Reply With Quote
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628

The chart symbol. If I want to reproduce your chart picture you posted, what do I have to set up?

Chart symbol - for example SPY, MSFT, GOOG etc.
Barinterval - for example Daily, 2 Years back.


GoldenRatio View Post
Symbol should be blue up arrow. I want it to run on both the daily and weekly chart time frames.


Follow me on Twitter Reply With Quote
Thanked by:
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628

A good way to find out what is going within your code is by adding plots or print statements.
If you add this to the end of your code, it will add a plot to the chart showing +1 when your conditions are met and 0, when they are not. So you can easily see if the arrow is maybe just out of sight.
The print statement will output the values to the print log, so you can exactly see what is going on and why an arrow is missing.

Regards,
ABCTG

 
Code
if Volume > SMA10Volume AND Close > Close[1] AND Stock_Range >= 0.50 then
	Plot1( +1 )
else
	Plot1( 0 );

Print( ElDateToString( Date ), "; Volume: ", Volume, "; SMA10Volume: ", SMA10Volume, "; Close: ", Close, "; Close[1]: ", Close, "; Stock_Range: ", Stock_Range ) ;

Follow me on Twitter Reply With Quote
Thanked by:
  #8 (permalink)
 
GoldenRatio's Avatar
 GoldenRatio 
Philadelphia, PA
 
Experience: Advanced
Platform: Matlab, TradeStation
Trading: Stocks
Posts: 211 since Aug 2012
Thanks Given: 5,192
Thanks Received: 296

Sorry for being so dense!

Symbol: ALXN
Barinterval: Daily

Started this thread Reply With Quote
Thanked by:
  #9 (permalink)
 
GoldenRatio's Avatar
 GoldenRatio 
Philadelphia, PA
 
Experience: Advanced
Platform: Matlab, TradeStation
Trading: Stocks
Posts: 211 since Aug 2012
Thanks Given: 5,192
Thanks Received: 296


ABCTG View Post
A good way to find out what is going within your code is by adding plots or print statements.
If you add this to the end of your code, it will add a plot to the chart showing +1 when your conditions are met and 0, when they are not. So you can easily see if the arrow is maybe just out of sight.
The print statement will output the values to the print log, so you can exactly see what is going on and why an arrow is missing.

Regards,
ABCTG

 
Code
if Volume > SMA10Volume AND Close > Close[1] AND Stock_Range >= 0.50 then
	Plot1( +1 )
else
	Plot1( 0 );

Print( ElDateToString( Date ), "; Volume: ", Volume, "; SMA10Volume: ", SMA10Volume, "; Close: ", Close, "; Close[1]: ", Close, "; Stock_Range: ", Stock_Range ) ;

I added the statement and it does show a value of 1 on the last bar.

If the arrow is out of sight, how do I set the chart to resize to automatically show indicator?

Started this thread Reply With Quote
  #10 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628


GoldenRatio,

no worries. Your code is correctly working, good job. The arrow is just outside the visual area. You can check this by setting the symbol to center last price.

Although this is not a good setting for charting. I would suggest trying to set the subgraph margins Lower and Upper to maybe 10%.

Regards,
ABCTG


GoldenRatio View Post
Sorry for being so dense!

Symbol: ALXN
Barinterval: Daily


Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on October 26, 2014


© 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