NexusFi: Find Your Edge


Home Menu

 





PaintBar Problems...


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,380 views
    2. thumb_up 4 thanks given
    3. group 3 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread

PaintBar Problems...

  #1 (permalink)
netarchitech
NY, NY
 
Posts: 68 since Dec 2011
Thanks Given: 27
Thanks Received: 19

Hi,

I am currently trying to learn Tradestation's EasyLanguage and have come across an error ("this plot has been defined using a different name") that I cannot resolve no matter what I try...

 
Code
inputs:
priceC( close ) ,
priceL( low )
VTperiod( 22 ) ;

variables:
VT ( 0 ) ,
ColorToUse ( 0 ) ;

VT = ( ( Highest ( priceC, VTperiod ) - priceL ) / ( Highest ( priceC, VTperiod ) ) * 100 ) ;
Plot1(  VT, !( "VT" ), RGB ( 0, 128, 0 ), Default, 5  ) ;

if VT = 0 then
	ColorToUse = Yellow ;
	
PlotPaintBar( High, Low, Open, Close, "VT" , ColorToUse ) ;


Thanks in advance

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Quant vue
Trading Reviews and Vendors
How to apply profiles
Traders Hideout
What broker to use for trading palladium futures
Commodities
Trade idea based off three indicators.
Traders Hideout
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


netarchitech,

PlotPaintBar will automatically receive Plot1 to Plot4 (or to Plot2 in case you only specify two parameters for BarHigh, BarLow, BarOpen, BarClose). This results in your code using Plot1 twice and the easiest fix would be to use a different plot number for your current Plot1 (for example Plot5).

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
netarchitech
NY, NY
 
Posts: 68 since Dec 2011
Thanks Given: 27
Thanks Received: 19

Hi ABCTG,

Thank you for your reply. I really appreciate your assistance...

I incorporated the changes you specified and it did solve the issue. The code compiled successfully. Unfortunately, the study paints all the bars yellow instead of just the bars where VT = 0...

 
Code
inputs:
priceC( close ) ,
priceL( low )
VTperiod( 22 ) ;

variables:
VT ( 0 ) ,
ColorToUse ( 0 ) ;

VT = ( ( Highest ( priceC, VTperiod ) - priceL ) / ( Highest ( priceC, VTperiod ) ) * 100 ) ;
Plot5(  VT, !( "VT" ), RGB ( 0, 128, 0 ), Default, 5  ) ;

if VT = 0 then
	ColorToUse = Yellow ;
	
PlotPaintBar( High, Low, Open, Close, "VT" , ColorToUse ) ;


Any thoughts?

Thanks again

Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

netarchitech,

you are welcome. Your code doesn't use any alternative colors and once "VT = 0" is fulfilled the variable ColorToUse will be set to yellow and as you use this for the bar colors all future bars will be yellow.
Depending on your preferences you could for example change the value in ColorToUse to an alternative color in case VT is different than 0.

Regards,

ABCTG



netarchitech View Post
Hi ABCTG,

Thank you for your reply. I really appreciate your assistance...

I incorporated the changes you specified and it did solve the issue. The code compiled successfully. Unfortunately, the study paints all the bars yellow instead of just the bars where VT = 0...

 
Code
inputs:
priceC( close ) ,
priceL( low )
VTperiod( 22 ) ;

variables:
VT ( 0 ) ,
ColorToUse ( 0 ) ;

VT = ( ( Highest ( priceC, VTperiod ) - priceL ) / ( Highest ( priceC, VTperiod ) ) * 100 ) ;
Plot5(  VT, !( "VT" ), RGB ( 0, 128, 0 ), Default, 5  ) ;

if VT = 0 then
	ColorToUse = Yellow ;
	
PlotPaintBar( High, Low, Open, Close, "VT" , ColorToUse ) ;


Any thoughts?

Thanks again


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

netarchitech,

another approach could be to include the paint bar plotting within your condition to only plot the bars that match your criteria.

 
Code
if VT = 0 then
begin
	ColorToUse = Yellow ;
	PlotPaintBar( High, Low, Open, Close, "VT" , ColorToUse ) ;
End 
else //unpaint the bar if the criteria is no longer true
begin
	NoPlot( 1 ) ; 
	NoPlot( 2 ) ;
	NoPlot( 3 ) ;
	NoPlot( 4 ) ;
end ;
Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #7 (permalink)
netarchitech
NY, NY
 
Posts: 68 since Dec 2011
Thanks Given: 27
Thanks Received: 19

Hi ABCTG,

It works! Thanks again for your assistance

Best Regards,

netarchitech

Reply With Quote
Thanked by:
  #8 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

Hi netarchitech,

thank you for your feedback, I am glad to hear that.

Regards,

ABCTG


netarchitech View Post
Hi ABCTG,

It works! Thanks again for your assistance

Best Regards,

netarchitech


Follow me on Twitter Reply With Quote




Last Updated on May 16, 2019


© 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