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 iceman2018, Today, 05:07 PM
    0 responses
    0 views
    0 likes
    Last Post iceman2018  
    Started by rhyminkevin, Today, 04:58 PM
    0 responses
    18 views
    0 likes
    Last Post rhyminkevin  
    Started by lightsun47, Today, 03:51 PM
    0 responses
    6 views
    0 likes
    Last Post lightsun47  
    Started by 00nevest, Today, 02:27 PM
    1 response
    14 views
    0 likes
    Last Post 00nevest  
    Started by futtrader, 04-21-2024, 01:50 AM
    4 responses
    49 views
    0 likes
    Last Post futtrader  
    Working...
    X