NexusFi: Find Your Edge


Home Menu

 





PaintBar Problems...


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #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?
CPI Eve: Fed Hike Odds Hold at 52% for the First Time, I …
Prediction Markets & Event Contracts
UCL Final Kicks Off at Noon ET: PSG at 56.5% as Iran May …
Prediction Markets & Event Contracts
Trump Media to sell instant access to market-moving soci …
Traders Hideout
CME Launches Bitcoin Volatility Futures June 1 -- First …
Cryptocurrency
More Than Capable: Hegseths War Warning Validates $114M …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
15 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643


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 X 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,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

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 X Reply With Quote
Thanked by:
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

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 X 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,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

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 X Reply With Quote




Last Updated on May 16, 2019


© 2026 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 - Downloads - Top
no new posts