NexusFi: Find Your Edge


Home Menu

 





Need Help w/ PaintBar Code


Discussion in EasyLanguage Programming

Updated
    1. trending_up 3,267 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 1 attachments




 
Search this Thread

Need Help w/ PaintBar Code

  #1 (permalink)
 
ChrisMoody's Avatar
 ChrisMoody 
Chapel Hill, NC
 
Experience: Advanced
Platform: Trade Navigator, MultiCharts, TOS
Broker: Stage 5, FXCM, IQ Feed
Trading: Futures, Forex, Options
Posts: 12 since Aug 2011
Thanks Given: 22
Thanks Received: 3

Hello...Need someones Expertise.

I've coded several PaintBar indicators in MultiCharts. However, I'm running in to a problem with this code. The issue is the PaintBar colors ONLY 2 Bars after the condition = True on the second bar. Currently the code is painting every bar that meets the condition. Obviously I'm not coding the condition correctly.

See Screenshot for Visual which has the Rules that my code obviously isn't defining the rules correctly. I've never had to write code that only #1 PaintsBars Two Bars when the condition is true for current bar and bar[1]. #2 Only Paints 2 Bars when condition is True and no Additional bars until the condition becomes False....Then it should start over and paint the next two consecutive bars when the condition is true again.

Rule: If Low and Low[1] > than SMA Then PlotPaintBar for only those 2 Bars. The condition can't be True again until the Low of a bar is <= the SMA....after that the condition/Rule bocomes Valid again to plot the PaintBars if Two bars meet the criteria.

Code is Below....I took out a few conditions to keep code simple and I couldn't remember if the TRH and TRL needed to stay in...

 
Code
Inputs:
       UpColor2B(Green);
      
variables:
       MacH(0),
       TRH(0),
       TRL(0);
   
//MacH = SMA( Close, 10) ;
MacH = AverageFC( Close, 10) ;

TRH = maxlist( close[1], high);
TRL = minlist( close[1], Low);
      
condition1 = Low > MacH ;

if condition1 then
       begin
       PlotPaintBar(High, Low, Open, Close, "2BarUp", UpColor2B);
       //PlotPaintBar(High[1], Low[1], Open[1], Close[1], "2BarUp", UpColor2B);
       //PlotPaintBar(High, Low, Open, Close, "2BarUp", UpColor2B);
       Alert ;
       End ;

Thanks SOO Much for Your Help!!!


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
35 thanks
Bigger Wins or Fewer Losses?
24 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628


ChrisMoody,

you need to check for the number of bars you allow to plot. In your code you could start a counter when Condition1 is true and as long as the counter <= 2 (or any other input) the paintbars are allowed to plot.
When Condition1 = false you set the counter back to 0.

 
Code
Inputs:
       UpColor2B(Green),
       BarsToPlot(2);
      
variables:
	Counter(0),
       MacH(0),
       TRH(0),
       TRL(0);
   
//MacH = SMA( Close, 10) ;
MacH = AverageFC( Close, 10) ;

TRH = maxlist( close[1], high);
TRL = minlist( close[1], Low);
      
condition1 = Low > MacH ;

if condition1 = false then
	Counter = 0;

if condition1 then 
	Counter += 1;
	
if Counter > 0 and Counter <= BarsToPlot then
       begin
       PlotPaintBar(High, Low, Open, Close, "2BarUp", UpColor2B);
       //PlotPaintBar(High[1], Low[1], Open[1], Close[1], "2BarUp", UpColor2B);
       //PlotPaintBar(High, Low, Open, Close, "2BarUp", UpColor2B);
       Alert ;
       End ;
Regards,
ABCTG


ChrisMoody View Post
Hello...Need someones Expertise.

I've coded several PaintBar indicators in MultiCharts. However, I'm running in to a problem with this code. The issue is the PaintBar colors ONLY 2 Bars after the condition = True on the second bar. Currently the code is painting every bar that meets the condition. Obviously I'm not coding the condition correctly.

See Screenshot for Visual which has the Rules that my code obviously isn't defining the rules correctly. I've never had to write code that only #1 PaintsBars Two Bars when the condition is true for current bar and bar[1]. #2 Only Paints 2 Bars when condition is True and no Additional bars until the condition becomes False....Then it should start over and paint the next two consecutive bars when the condition is true again.

Rule: If Low and Low[1] > than SMA Then PlotPaintBar for only those 2 Bars. The condition can't be True again until the Low of a bar is <= the SMA....after that the condition/Rule bocomes Valid again to plot the PaintBars if Two bars meet the criteria.

Code is Below....I took out a few conditions to keep code simple and I couldn't remember if the TRH and TRL needed to stay in...

 
Code
Inputs:
       UpColor2B(Green);
      
variables:
       MacH(0),
       TRH(0),
       TRL(0);
   
//MacH = SMA( Close, 10) ;
MacH = AverageFC( Close, 10) ;

TRH = maxlist( close[1], high);
TRL = minlist( close[1], Low);
      
condition1 = Low > MacH ;

if condition1 then
       begin
       PlotPaintBar(High, Low, Open, Close, "2BarUp", UpColor2B);
       //PlotPaintBar(High[1], Low[1], Open[1], Close[1], "2BarUp", UpColor2B);
       //PlotPaintBar(High, Low, Open, Close, "2BarUp", UpColor2B);
       Alert ;
       End ;

Thanks SOO Much for Your Help!!!



Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
 
ChrisMoody's Avatar
 ChrisMoody 
Chapel Hill, NC
 
Experience: Advanced
Platform: Trade Navigator, MultiCharts, TOS
Broker: Stage 5, FXCM, IQ Feed
Trading: Futures, Forex, Options
Posts: 12 since Aug 2011
Thanks Given: 22
Thanks Received: 3


Quoting 
you need to check for the number of bars you allow to plot. In your code you could start a counter when Condition1 is true and as long as the counter <= 2 (or any other input) the paintbars are allowed to plot.
When Condition1 = false you set the counter back to 0.

ABCTG,

Thank You....Greatly Appreciate it...

Started this thread Reply With Quote




Last Updated on May 7, 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