Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Output Window Print Volume of the entry candle of just the losing Trades

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

    Output Window Print Volume of the entry candle of just the losing Trades

    Hello, I hope you can help me with this. First of all Im not a programer. I'm learning with this ninjatrader!!!

    I need to do 2 things:

    1) I have built an strategy and I have ran it through 180 days. From This Strategy I wish to Print in the outputWindow JUST the Volume of the Entry Candles and Stochastics, ONLY OF THE LOOSING TRADES.

    2) I'm Trying to define a variable that Calculates The average volume of the last 7 Candles

    private VOL VOL1;

    VOL1 = VOL(Close);


    ((VOL1[1] + VOL1[2] + VOL1[3] + VOL1[4] + VOL1[5] + VOL1[6] + VOL1[7]) / 7). Can you please explain me how do I Define this Variable?

    Thanks in advance!!

    Roberto

    #2
    Hello RobertoPaez,

    Thanks for your post.

    One approach would be to save the strategies RealizedPNL (accumulates as the strategy trades) into a variable and at the end of each trade (when you are flat) compare the new realized PNL to the saved PNL in the variable as that would be the difference the last trade made. If the difference is less than zero then it was a losing trade. Here is a link to obtaining the realized PNL of the strategy (that accumulates): https://ninjatrader.com/support/help...?cumprofit.htm

    The other way to determine if the last trade was a losing trade is to check the Trades collection. Please see example 1 on this page: https://ninjatrader.com/support/help...collection.htm If the "last trade" profit is negative it was a losing trade.

    For the variable declaration, you would want to declare the variable as a double type, for example, private double myAvgVolume.

    So then myAvgVolume = ((VOL1[1] + VOL1[2] + VOL1[3] + VOL1[4] + VOL1[5] + VOL1[6] + VOL1[7]) / 7);

    Alternately you could use a simple moving average for this: myAvgVolume = SMA(Volume, 7)[1];
    Volume is a data series, reference: https://ninjatrader.com/support/help...lumeseries.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you very much!!! I Appreciate it!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Cross161, Today, 10:33 PM
      0 responses
      3 views
      0 likes
      Last Post Cross161  
      Started by neilzep, Today, 08:55 PM
      0 responses
      6 views
      0 likes
      Last Post neilzep
      by neilzep
       
      Started by javier.filgueira, Today, 03:29 PM
      3 responses
      10 views
      0 likes
      Last Post javier.filgueira  
      Started by Da vinci, Today, 03:15 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by Da vinci, Today, 02:51 PM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Working...
      X