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 bmartz, Today, 09:30 AM
    2 responses
    11 views
    0 likes
    Last Post bltdavid  
    Started by f.saeidi, Today, 11:02 AM
    1 response
    2 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by geotrades1, Today, 10:02 AM
    4 responses
    12 views
    0 likes
    Last Post geotrades1  
    Started by rajendrasubedi2023, Today, 09:50 AM
    3 responses
    16 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by lorem, Today, 09:18 AM
    2 responses
    11 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X