Any help would be appreciated. If I can't figure out something this simple I will abandon using this program.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Frustrated
Collapse
X
-
Frustrated
I am trying to do what I considered a simple trade strategy. I want to trigger a trade based on ATR trailing stop. I can clearly see the point when I chart it but have been unable to figure out how to cause a trade to occur using the strategy wizard.
Any help would be appreciated. If I can't figure out something this simple I will abandon using this program.Tags: None
-
Hi uwuffle,
I'd be happy to assist you, but first, can you describe a little more about how you want the strategy to behave...
1. At what value of the ATR do you want to enter a trade, to exit?
2. How do you want the trailing stop to behave?
Here are some great tutorial on the subject
Simple MA Crossover - http://www.ninjatrader-support.com/H...gyViaTheWizard
Also, every other week, there is a "Automated Strategy Development Level 1" webinar. Click the link in my signature for a schedule of live events.TimNinjaTrader Customer Service
-
Thank you for the pointer. I have been thru all that training and I can make strategies using cross overs of averages etc. I am having a problem using ATRTrailingStop.
I was trying to keep it simple and just go long when it signalled down and exit when it signalled up. If you just pick AA from the DOW, do a daily chart and apply ATRTrailingStop indicator (I used defaults) to the chart you will get arrows at the locations I want to trigger actions.
Comment
-
uwuffle,
Unfortunately this would depend on how the particular indicator you are using is programmed. If the author made the indicator have programmatically accessible events for those locations then you can check against those, otherwise it would not be possible through the Strategy Wizard.Josh P.NinjaTrader Customer Service
Comment
-
The current indicator code provide is below, I don't see any events.
protected override void Initialize()
{
Add(new Plot(Color.Blue, PlotStyle.Line, "Trailing Stop"));
CalculateOnBarClose = true;
Overlay = true;
BarsRequired = 1;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (CurrentBar < 1)
return;
// Trailing stop
double trail;
double loss = ATR(Input, Period)[0] * Multi;
if (Close[0] > Value[1] && Close[1] > Value[1])
trail = Math.Max(Value[1], Close[0] - loss);
else if (Close[0] < Value[1] && Close[1] < Value[1])
trail = Math.Min(Value[1], Close[0] + loss);
else if (Close[0] > Value[1])
{
trail = Close[0] - loss;
DrawArrowDown(CurrentBar.ToString(), false, 1, Value[1], Color.Orange);
}
else
{
trail = Close[0] + loss;
DrawArrowUp(CurrentBar.ToString(), false, 1, Value[1], Color.Orange);
}
Value.Set(trail);
}
Is it as easy as creating a new ninja script strategy and putting this same code in the Initialization block and changing the DrawArrows to EnterLong or EnterShort?
Or should I edit the indicator and add events in the drawup and draw down to use in the strategy?
Comment
-
ok, sounds like I will just have to code it.
One additional question, if select Tools->Edit NinjaScript->Strategy
and select a strategy, it pops open the wizard, I can select view code but the code is read only. Do I have to export the ninja script out to edit it. I didn't believe this was the expected behavior.
Type: SimulationOnly
.NET/CLR Version: 2.0.50727.4200
Expiration: 11/30/2099
Licensed features: AdvancedStrategyManagement
AutomatedTrading
BasicEntry
Charting
SuperDom
Licensed providers: Collective2
IQFeed
ESignal
External
Barchart.com
Google
Replay
Simulator
Yahoo
Gain
Zen-Fire
InteractiveBrokers
MBTrading
Patsystems
PFG
Vision Financial Markets
TD AMERITRADE
TrackData
TradingTechnologies
Comment
-
Ok I coded the strategy and the simple one worked as expected.
It executes EnterLong() as it should.
I am building on the script to have it add to my long position.
I have the following code block:
if(Position.MarketPosition == MarketPosition.Long)
{
String s2 = " Current Position Size:" + Position.Quantity.ToString();
Log(s2, NinjaTrader.Cbi.LogLevel.Information);
EnterLong(500, "daily long add");
}
The Log message gets logged to the log so I know its entering the code block, but no new shares are ever purchased?
Comment
-
Hi uwuffle,
You can set the Entry Handling to "UniqueEntries" when you apply the strategy, or even hard code it in to the strategy.
More info at - http://www.ninjatrader-support.com/H...xEntryHandlingTimNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Tin34, Today, 03:30 AM
|
2 responses
15 views
0 likes
|
Last Post
by Tin34
Today, 04:11 AM
|
||
Started by sastrades, Yesterday, 09:59 AM
|
2 responses
28 views
0 likes
|
Last Post Today, 04:06 AM | ||
Started by ETFVoyageur, Today, 12:52 AM
|
1 response
14 views
0 likes
|
Last Post Today, 03:36 AM | ||
Started by lollers, Today, 03:26 AM
|
0 responses
10 views
0 likes
|
Last Post
by lollers
Today, 03:26 AM
|
||
Started by aliyahany, Today, 03:16 AM
|
0 responses
2 views
0 likes
|
Last Post
by aliyahany
Today, 03:16 AM
|
Comment