I have been trying for about a week to add a Black Swan Event filter to one of my Algo's but my skill with coding is still lacking, I could use a little help to see why this strategy keeps taking trades after the unrealized PNL max has been hit.
Anyway I created this test strategy for the sole purpose of making alot of real bad trades that would making testing it alot faster. A few things that may affect this working are. Its run on a 24/7 session and on Forex Currency market.
Here is my test strategy that if I can get the code logic right can be a boiler plate to use in reference with my real strategies.
Thanks Quantismo
UPDATE: SOLVED THE PROBLEM ... The Iorder Sample that I posted did the trick...
#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
namespace NinjaTrader.Strategy
{
// This strategy has been made only to generate lots of unprofitable trades on a small 5 to 20 tick chart to
// make sure it turns off the strategy and closes the position each time the unrealized PNL drops below a set $ amount
// and this Strategy is for testing purposes only, not for generating any sort of profit.
[Description("To not loose my @#$#$")]
public class BLACKSWANTEST : Strategy
{
#region Variables
private int priorTradesCount = 0;
private double priorTradesCumProfit = 0;
private int myLots = 200000;