Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Fisher Transform question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Fisher Transform question

    Hi,
    I REALLY suck at building even basic strategies. It won't work and I don't why.
    On backtesting it buys all over the place or not at all when it should.
    Indicators
    SMA 150 Fisher Transform 15 day
    Entry Price must be above SMA150
    Fisher Transform 15 day must be below -1
    Fisher Transform must cross up through an SMA 1 of itself + offset of 1

    Exit Fisher Transform line crosses down through SMA1 of itself + offset of 1

    Here is the code: (do I post here??)
    Thanks to anyone who can spot my probably simple error.


    Description = @"Enter when 1) Fisher Transform 15 Day less than - 1. 2) Price above 150 SMA 3)Fisher Transform crosses up through SMA of FIsher Transform 1 + 1 4) sell when Fisher Transform crosses down through SMA 1+1 (offset)";
    Name = "FisherXMAup1";
    Calculate = Calculate.OnBarClose;
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.AllEntries;
    IsExitOnSessionCloseStrategy = true;
    ExitOnSessionCloseSeconds = 30;
    IsFillLimitOnTouch = false;
    MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
    OrderFillResolution = OrderFillResolution.Standard;
    Slippage = 0;
    StartBehavior = StartBehavior.WaitUntilFlat;
    TimeInForce = TimeInForce.Gtc;
    TraceOrders = false;
    RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
    StopTargetHandling = StopTargetHandling.PerEntryExecution;
    BarsRequiredToTrade = 20;
    // Disable this property for performance gains in Strategy Analyzer optimizations
    // See the Help Guide for additional information
    IsInstantiatedOnEachOptimizationIteration = true;
    }
    else if (State == State.Configure)
    {
    }
    else if (State == State.DataLoaded)
    {
    FisherTransform1 = FisherTransform(Close, 15);
    FisherTransform1.Plots[0].Brush = Brushes.DodgerBlue;
    AddChartIndicator(FisherTransform1);
    SMA1 = SMA(Close, 150);
    SMA1.Plots[0].Brush = Brushes.Goldenrod;
    AddChartIndicator(SMA1);
    SMA2 = SMA(FisherTransform1, 1);
    SMA2.Plots[0].Brush = Brushes.Goldenrod;
    AddChartIndicator(SMA2);
    SMA3 = SMA(FisherTransform1, 1);
    SMA3.Plots[0].Brush = Brushes.Goldenrod;
    AddChartIndicator(SMA3);
    }
    }

    protected override void OnBarUpdate()
    {
    if (CurrentBars[0] < 15)
    return;

    // Set 1
    if ((FisherTransform1[0] < -1)
    && (Close[0] > SMA1[0])
    && (CrossAbove(FisherTransform1, SMA2, 1)))
    {
    EnterLong(Convert.ToInt32(DefaultQuantity), "");
    }

    // Set 2
    if (CrossBelow(FisherTransform1, SMA3, 1))
    {
    ExitLong(Convert.ToInt32(DefaultQuantity), "", "");
    }

    }
    }
    }

    #2
    Hello GeminiSi,

    Thank you for writing in.

    I would suggest adding print statements to check whether your conditions are becoming true. I’ve provided a link to a youtube video which covers an example of using prints to understand behavior:

    Dive into manipulating C# code from within an unlocked NinjaScript strategy using the NinjaScript Editor.NinjaTrader 7 is an award winning end to end online ...


    I’ve provided a link covering debugging which you may find helpful.
    Debugging: http://ninjatrader.com/support/forum...ead.php?t=3418

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CortexZenUSA, Today, 12:53 AM
    0 responses
    1 view
    0 likes
    Last Post CortexZenUSA  
    Started by CortexZenUSA, Today, 12:46 AM
    0 responses
    1 view
    0 likes
    Last Post CortexZenUSA  
    Started by usazencortex, Today, 12:43 AM
    0 responses
    5 views
    0 likes
    Last Post usazencortex  
    Started by sidlercom80, 10-28-2023, 08:49 AM
    168 responses
    2,266 views
    0 likes
    Last Post sidlercom80  
    Started by Barry Milan, Yesterday, 10:35 PM
    3 responses
    13 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X