Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Access Values of Indicator

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

  • NinjaTrader_Jim
    replied
    Hello Tasse555,

    Thanks for your post.

    Below is a video demonstrating that the indicator is properly getting read, and logic can be built with this indicator. When I use the indicator to control a condition which controls my EnterLong method, I can see my logic is becoming true and allowing the order method to be reached.

    Demo - https://drive.google.com/file/d/1C9A...w?usp=drivesdk

    I have also included additional videos debugging tips with the Strategy Builder. These steps would be taken to confirm that your order submission logic is allowing your order submission methods to be reached.

    Debugging in the Strategy Builder - https://drive.google.com/file/d/1mTq...w?usp=drivesdk

    Debugging Demo - https://drive.google.com/file/d/1rOz...w?usp=drivesdk

    We look forward to assisting.
    Last edited by NinjaTrader_Jim; 05-18-2020, 08:42 AM.

    Leave a comment:


  • Tasse555
    replied
    Hi Jim,

    thank you for the example. But this also does not work. I'm using TickReplay and the Indicator shows the correct values (both indicator do), but the strategy does not trigger any Long-trade. (That is my simple strategy approach, to see, if the strategy works with the indicator)


    This is how i use your example indicator:
    <code>
    namespace NinjaTrader.NinjaScript.Strategies
    {
    public class MyCustomStrategy1 : Strategy
    {

    private BuySellVolumeOneTick bsv;

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Geben Sie hier die Beschreibung für die neue benutzerdefinierte Strategie.";
    Name = "MyCustomStrategy1";
    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;

    BuySellVolumeOneTick().Calculate = Calculate.OnEachTick;
    }
    else if (State == State.Configure)
    {
    }
    }

    protected override void OnBarUpdate()
    {
    if (State == State.Historical || BuySellVolumeOneTick().SellVolume[0] > 30){
    EnterLong();
    }
    }
    }
    }
    </code>

    Kind regards

    Leave a comment:


  • NinjaTrader_Jim
    replied
    Welcome to the forums Tasse555!

    BuySellVolume relies on OnMarketData and will not generate historical plots unless Tick Replay is used. The indicator also sets plot values after the bar has been processed, so it may not be best for designing a strategy.

    I have attached a different version of this indicator that uses a Multi Time Frame approach which would not use Tick Replay. There can be slight differences when ticks are received with the same timestamp, but in general, this sort of script would be better suited for use in a strategy. To use it in the Strategy Builder, you will need to add a single tick data series to the Additional Data Page of the Strategy Builder.

    We look forward to assisting.

    (Update 2023.01.10 - resetting volume to 0 on new bar)

    BuySellVolumeOneTickExample_NT8.zip
    Last edited by NinjaTrader_ChelseaB; 01-10-2023, 12:27 PM.

    Leave a comment:


  • Tasse555
    started a topic Access Values of Indicator

    Access Values of Indicator

    Hi,

    i'm trying to build my first strategy. I want to use the values of the BuySellVolume indicator, but it seems like the DataSeries from the indicator are empty.
    No trade entry happens with this strategy....

    The code looks like this:


    namespace NinjaTrader.NinjaScript.Strategies
    {
    public class DeltaRatioKursDivergenz : Strategy
    {

    private BuySellVolume bsv;

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Wenn Delta positiv, long gehen";
    Name = "DeltaRatioKursDivergenz";

    // 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)
    {
    bsv = BuySellVolume();
    AddChartIndicator(bsv);
    }
    }

    protected override void OnBarUpdate()
    {
    if (bsv.Sells[0] > 0){
    EnterLong();
    }
    }
    }
    }

    Could you please help me with this? Thank you.

    Kind regars,
    Malte

Latest Posts

Collapse

Topics Statistics Last Post
Started by RichardHK, 08-22-2024, 09:02 AM
4 responses
60 views
0 likes
Last Post RichardHK  
Started by HGTrader, Today, 09:31 AM
1 response
6 views
0 likes
Last Post NinjaTrader_Gaby  
Started by Gibranes, 10-12-2024, 04:02 AM
3 responses
16 views
0 likes
Last Post NinjaTrader_Jesse  
Started by dbennett3, Today, 09:18 AM
1 response
9 views
0 likes
Last Post NinjaTrader_Clayton  
Started by cupir2, Yesterday, 05:27 PM
1 response
14 views
0 likes
Last Post NinjaTrader_Jesse  
Working...
X