NexusFi: Find Your Edge


Home Menu

 





Just A little help to finish !!!


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Sadboybh with 4 posts (0 thanks)
    2. looks_two Big Mike with 3 posts (2 thanks)
    3. looks_3 Fat Tails with 1 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 2,031 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 9 posts
    2. attach_file 0 attachments




 
Search this Thread

Just A little help to finish !!!

  #1 (permalink)
Sadboybh
Bahrain
 
Posts: 12 since May 2011
Thanks Given: 4
Thanks Received: 0

Hi Guys,

I have finished programing this double SMA indicator with arrows when Crossover.
the only thing left and i struggled to add to this simple indicator is to make the fast SMA changes it's color to LIME when it's Crossabove the slow moving average and a RED color when it's crossBelow the slow moving average. I will post my script and i would appreciate it if anyone could help in coding the color changing of the fast moving average to finish this indicator
=====
#region Variables
// Wizard generated variables
private int average = 14; // Default setting for Average
private int trigger = 11; // Default setting for Trigger


// User defined variables (add any user defined variables below)

private Color buyArrowColor = Color.Lime;
private Color sellArrowColor = Color.Red;
#endregion

/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(new Pen(Color.Blue,2f), PlotStyle.Line, "Avg"));
Add(new Plot(new Pen(Color.White,2f), PlotStyle.Line,"Trigger"));

Plots[1].Pen.DashStyle = DashStyle.Dash;


Overlay = true;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
Avg.Set(SMA(Average)[0]);
Trg.Set(SMA(Trigger)[0]);

//buy condition:
if (CrossAbove(SMA(Trigger),SMA(Average),1))

DrawArrowUp("MyArrowUp"+CurrentBar,0, Avg[0],buyArrowColor);




//sell condition:
if (CrossBelow(SMA(Trigger),SMA(Average),1))
DrawArrowDown("MyArrowDn"+CurrentBar,0, Avg[0],sellArrowColor);
}

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
18 thanks
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,443 since Jun 2009
Thanks Given: 33,217
Thanks Received: 101,606


Hi,

Did you try what I posted already in your other thread?:

Try watching @sam028's basic intro webinar on NT programming which covers multi color plots:


And/or @shodson's NT webinar which gives you the basic building blocks of C#:


Or look at any one of the hundreds of indicators on nexusfi.com (formerly BMT) that have multicolor plots and look at the code and learn. This is the simplest.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
Sadboybh
Bahrain
 
Posts: 12 since May 2011
Thanks Given: 4
Thanks Received: 0


Big Mike View Post
Hi,

Did you try what I posted already in your other thread?:

Try watching @ sam028's basic intro webinar on NT programming which covers multi color plots:


And/or @ shodson's NT webinar which gives you the basic building blocks of C#:


Or look at any one of the hundreds of indicators on nexusfi.com (formerly BMT) that have multicolor plots and look at the code and learn. This is the simplest.

Mike

even though the videos aren't working with me, but thanks a lot Mike
beside I know what i needed was simple, but that's simple for you brother, you're experienced and professional @ it, for a starter guy like it will sound a little bit hard but don't worry mate I'll find out a way to get it working somehow.
BTW, i downloaded some muliticolors indicator from the forum and tried to see the code but unfortunately couldn't apply it on mine ..

thanks again

Reply With Quote
  #5 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,443 since Jun 2009
Thanks Given: 33,217
Thanks Received: 101,606

If you are not a programmer, then best to hire your work done by a professional to get you started if you aren't willing to read books and example code and learn the language.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
 
gulabv's Avatar
 gulabv 
Dallas, TX
 
Experience: Beginner
Platform: Ninjatrader
Broker: Zen-Fire
Trading: ZN, 6E
Posts: 286 since May 2010
Thanks Given: 161
Thanks Received: 169

Try this piece of code in your crossabove logic block:
PlotColors[0][1] = Color.Lime;

Try this piece of code in your crossbelow logic block:
PlotColors[0][1] = Color.Red;

Reply With Quote
  #7 (permalink)
Sadboybh
Bahrain
 
Posts: 12 since May 2011
Thanks Given: 4
Thanks Received: 0


gulabv View Post
Try this piece of code in your crossabove logic block:
PlotColors[0][1] = Color.Lime;

Try this piece of code in your crossbelow logic block:
PlotColors[0][1] = Color.Red;

Thanks for your advice gulabv, i've tried this code before and it compiles fine but, when i apply the indicator i cant see any moving average they just disappear !!!

Reply With Quote
  #8 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,443 since Jun 2009
Thanks Given: 33,217
Thanks Received: 101,606


Sadboybh View Post
Thanks for your advice gulabv, i've tried this code before and it compiles fine but, when i apply the indicator i cant see any moving average they just disappear !!!

Attach your entire indicator .cs file and someone will more than likely help you by writing the code for you.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #9 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102

CrossAbove) and CrossBelow() only define the bar, when the trigger crosses the average. To color you averages you do not want to use them, but use the simple conditions

 
Code
if (Trg[0] > Avg[0])
{     
   PlotColors[0][0] = Color.Lime;
   PlotColors[1][0] = Color.Lime;
}
else
{     
   PlotColors[0][0] = Color.Red;
   PlotColors[1][0] = Color.Red;
}

Reply With Quote
Thanked by:
  #10 (permalink)
Sadboybh
Bahrain
 
Posts: 12 since May 2011
Thanks Given: 4
Thanks Received: 0



Fat Tails View Post
CrossAbove) and CrossBelow() only define the bar, when the trigger crosses the average. To color you averages you do not want to use them, but use the simple conditions

 
Code
if (Trg[0] > Avg[0])
{     
   PlotColors[0][0] = Color.Lime;
   PlotColors[1][0] = Color.Lime;
}
else
{     
   PlotColors[0][0] = Color.Red;
   PlotColors[1][0] = Color.Red;
}


Fat tails, thanks a lot bro, that's exactly what i was looking for, i really appreciate it

Reply With Quote




Last Updated on June 19, 2011


© 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