Whats might be the problem?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
no fills
Collapse
X
-
Hello sosMsos,
When i open a chart, choose a strategy and enable it, i dont get any fills?
Whats might be the problem?- The conditions aren't true for entry.
- You're not displaying trade executions.
If you want to test a basic strategy, use the provided SampleMACrossOver, and make sure PlotExecutions are enabled in the right click > Data Series screen. This should generally produce trades and show fills on the chart.Ryan M.NinjaTrader Customer Service
-
ya executions are plotted.
What dos this mean:
- The conditions aren't true for entry.
Backtesting works great
Here the strategy:
#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>
/// Enter the description of your strategy here
/// </summary>
[Description("trendfollow2minchart")]
public class trendfollow2minchart : Strategy
{
#region Variables
// Wizard generated variables
// 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(PeriodType.Day, 1);
//Add("^TICK", PeriodType.Minute, 1);
Add(RSI(4, 0));
Add(RSI(9, 0));
Add(EMA(21));
Add(EMA(55));
Add(EMA(200));
Add(ATR(14));
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (EMA(BarsArray[1], 21)[0] > EMA(BarsArray[1], 55)[0]
&& EMA(BarsArray[1], 55)[0] > EMA(BarsArray[1], 200)[0]
&& EMA(BarsArray[1], 55)[0] > EMA(BarsArray[1], 55)[1]
&& EMA(BarsArray[1], 200)[0] > EMA(BarsArray[1], 200)[1]
&& CrossBelow(RSI(4, 0).Avg, 30, 1))
{
if (BarsInProgress == 0)
EnterLong(DefaultQuantity, "");
}
// SetStopLoss("",CalculationMode.Ticks, (ATR(14)[0]) * (250), false);
// Condition set 2
if (CrossAbove(RSI(9, 0).Avg, 70, 1))
{
ExitLong("");
}
// Condition set 3
if (CrossBelow(RSI(4, 0).Avg, 78, 1))
{
ExitLong("");
}
// Condition set 3
if (CrossBelow(RSI(9, 0).Avg, 30, 15)
&& CrossAbove(RSI(9, 0).Avg, 45, 1))
{
ExitLong("");
}
}
#region Properties
#endregion
}
}
Comment
-
What dos this mean:
The conditions aren't true for entry.
If you are adding daily series to your strategy, you should look at the amount of data loaded on the chat to make sure there is enough. Check this in the Right Click > Data Series screen.
Check log tab of control center for any error messages.
In order to track what your strategy is doing, you can debug with Print() statements and TraceOrders output.
Use plenty of Print() statements to verify values are what you expect.
Add TraceOrders = true to your Initialize method and you can then view output related to strategy submitted orders through Tools > Output window.
It may also help to add drawing objects to your chart for signal confirmation. Additional help for these items is available at the following links:
Debugging your NinjaScript code.
TraceOrders
Drawing Objects.Ryan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Mestor, 03-10-2023, 01:50 AM
|
12 responses
307 views
0 likes
|
Last Post
by z.franck
Today, 04:29 AM
|
||
Started by AgriTrdr, 07-16-2023, 12:54 PM
|
32 responses
267 views
0 likes
|
Last Post
by f.saeidi
Yesterday, 06:49 AM
|
||
Started by Mestor, Today, 03:15 AM
|
0 responses
2 views
0 likes
|
Last Post
by Mestor
Today, 03:15 AM
|
||
Started by Padan, Today, 02:02 AM
|
0 responses
6 views
0 likes
|
Last Post
by Padan
Today, 02:02 AM
|
||
Started by bukowa, 11-09-2023, 06:07 PM
|
20 responses
409 views
0 likes
|
Last Post
by Adfra
Today, 01:36 AM
|
Comment