Can someone help me out? Thank you
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Drawing an Arrow
Collapse
X
-
Drawing Arrows
Thank you Josh. it works very well. Can you tell me ....when I start my strategy with the ema's the line's automatically come up. I'd like to be seeing only the arrows without the lines. Currently what I'm doing is changing the colors of the lines to white ( negating the appearance since my background is white ). However every time I change time frames thec hart resorts to the lins appearing.
Is there a way to save the changes so that when I start my strategy the lines do not appear?
Happy trades ! Ark 1
Comment
-
Hi Ray,
Again...I can't thank you enough for your support.
I've used either 'white'...or...transparent...it doesn't matter. They both do the job. My problem is the following. I'll go through my steps so that you can point out my mistakes.
1) after I've connected and my charts are up and running I must then right click on the chart and go through the process of starting up my strategy ( if there's a way around this please tell me...in other words...if I can open my charts> connect> and have my strategy start by default ...) that would be good.
2) when my strategy starts my charts, by default, display the arrows ( indicating the EMA crosses ) but in addition they also display the 'lines' ( orange colored by default ) for the EMA's.
3) I must then go to the indicators window and go through the process of making all of the 'ema lines' transparent so that the only thing that is visible on the chart are the arrows.
The big problem is that every time I change timeframes or instruments...or...open up the strategy...the ema lines appear again and I must go through the same steps to make them transparent.
Is there a method for accessing the 'orange ema lines' so that I can permanently make them transparent for my strategy? As I was going through the steps to creating my strategy I had the option of choosing the color for my arrows...but..the ema's give me no such option.
Billy
Comment
-
Comment
-
Hi Ray,
I'm almost there.
Josh states: To customize plot colors:
Code:
EMA(13).Plots[0].Pen.Color = Color.Blue; // Plots the EMA as a blue line
Ok...here's my strategy....can you please tell me where I am to insert this code?
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// EMA crosses create an arrow
/// </summary>
[Description("EMA crosses create an arrow")]
public class MTF : Strategy
{
#region Variables
// Wizard generated variables
private int fast = 15; // Default setting for Fast
private int slow = 38; // Default setting for Slow
private int rapid = 2; // Default setting for Rapid
private int tardy = 15; // Default setting for Tardy
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
Add(EMA(Fast));
Add(EMA(Slow));
Add(EMA(Fast));
Add(EMA(Slow));
Add(EMA(Rapid));
Add(EMA(Tardy));
Add(EMA(Rapid));
Add(EMA(Tardy));
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(EMA(Fast), EMA(Slow), 1))
{
DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0] + 1 * TickSize, Color.Black);
}
// Condition set 2
if (CrossBelow(EMA(Fast), EMA(Slow), 1))
{
DrawArrowDown("My down arrow" + CurrentBar, false, 0, Low[0] + 1 * TickSize, Color.Black);
}
// Condition set 3
if (CrossAbove(EMA(Rapid), EMA(Tardy), 1))
{
DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0] + 1 * TickSize, Color.Blue);
}
// Condition set 4
if (CrossBelow(EMA(Rapid), EMA(Tardy), 1))
{
DrawArrowDown("My down arrow" + CurrentBar, false, 0, Low[0] + 1 * TickSize, Color.Crimson);
}
}
Comment
-
Drawing an Arrow
Hi Ray,
Here's what I have...but does not work as of yet.
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Ema crosses and an arrow appears
/// </summary>
[Description("Ema crosses and an arrow appears")]
public class MiniTrendFinder : Strategy
{
#region Variables
// Wizard generated variables
private int fast = 15; // Default setting for Fast
private int slow = 38; // Default setting for Slow
private int rapid = 2; // Default setting for Rapid
private int tardy = 1; // Default setting for Tardy
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
Add(EMA(Fast));
Add(EMA(Slow));
EMA(Fast).Plots(0).Pen.Color = Color.Transparent;
EMA(Slow).Plots(0).Pen.Color = Color.Transparent;
Add(EMA(Fast));
Add(EMA(Slow));
EMA(Fast).Plots(0).Pen.Color = Color.Transparent;
EMA(Slow).Plots(0).Pen.Color = Color.Transparent;
Add(EMA(Rapid));
Add(EMA(Tardy));
EMA(Rapid).Plots(0).Pen.Color = Color.Transparent;
EMA(Tardy).Plots(0).Pen.Color - Color.Transparent;
Add(EMA(Rapid));
Add(EMA(Tardy));
EMA(Rapid).Plots(0).Pen.Color = Color.Transparent;
EMA(Tardy).Plots(0).Pen.Color = Color.Transparent;
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(EMA(Fast), EMA(Slow), 1))
{
DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0] + 1 * TickSize, Color.Black);
}
// Condition set 2
if (CrossBelow(EMA(Fast), EMA(Slow), 1))
{
DrawArrowDown("My down arrow" + CurrentBar, false, 0, Low[0] + 1 * TickSize, Color.Black);
}
// Condition set 3
if (CrossAbove(EMA(Rapid), EMA(Tardy), 1))
{
DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0] + 1 * TickSize, Color.Blue);
}
// Condition set 4
if (CrossBelow(EMA(Rapid), EMA(Tardy), 1))
{
DrawArrowDown("My down arrow" + CurrentBar, false, 0, Low[0] + 1 * TickSize, Color.Red);
}
}
#region Properties
[Description("Fast Period")]
[Category("Parameters")]
public int Fast
{
get { return fast; }
set { fast = Math.Max(1, value); }
}
[Description("Slow Period")]
[Category("Parameters")]
public int Slow
{
get { return slow; }
set { slow = Math.Max(1, value); }
}
[Description("Rapid Period")]
[Category("Parameters")]
public int Rapid
{
get { return rapid; }
set { rapid = Math.Max(1, value); }
}
[Description("Tardy Period")]
[Category("Parameters")]
public int Tardy
{
get { return tardy; }
set { tardy = Math.Max(1, value); }
}
#endregion
}
Now...looking at Josh's post he's also included ...
// Plots the EMA as a blue line
This line doesn't appear anywhere in my strategy.
Billy
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by burtoninlondon, Today, 12:38 AM
|
0 responses
5 views
0 likes
|
Last Post Today, 12:38 AM | ||
Started by AaronKoRn, Yesterday, 09:49 PM
|
0 responses
14 views
0 likes
|
Last Post
by AaronKoRn
Yesterday, 09:49 PM
|
||
Started by carnitron, Yesterday, 08:42 PM
|
0 responses
11 views
0 likes
|
Last Post
by carnitron
Yesterday, 08:42 PM
|
||
Started by strategist007, Yesterday, 07:51 PM
|
0 responses
13 views
0 likes
|
Last Post Yesterday, 07:51 PM | ||
Started by StockTrader88, 03-06-2021, 08:58 AM
|
44 responses
3,983 views
3 likes
|
Last Post
by jhudas88
Yesterday, 06:59 PM
|
Comment