topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday April 25, 2024, 4:52 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Niceperson [ switch to compact view ]

Pages: [1]
1
General Software Discussion / Re: Fractal Trading Indicator
« on: November 02, 2011, 04:28 PM »
Hello,

You are right that the code has to be placed in the right spot. I searched through the complete code file, but did not find any "alert" line. I have also attached the complete code file, syntax highlighted.

Please note that the code in Line 31 has been commented out because it gives sound on each tick.  Codes from line 106 are auto generated by Ninja system. I have just added them here for completeness.


Thanks


Code: Text [Select]
  1. #region Using declarations
  2. using System;
  3. using System.Diagnostics;
  4. using System.Drawing;
  5. using System.Drawing.Drawing2D;
  6. using System.ComponentModel;
  7. using System.Xml.Serialization;
  8. using NinjaTrader.Cbi;
  9. using NinjaTrader.Data;
  10. using NinjaTrader.Gui.Chart;
  11. #endregion
  12.  
  13. namespace NinjaTrader.Indicator
  14. {
  15.     [Description("")]
  16.     [Gui.Design.DisplayName("FractalPivot (TradeStation)")]
  17.     public class FractalPivot_TradeStation : Indicator
  18.     {
  19.         #region Variables
  20.                 private int pLeftStrength = 2;
  21.                 private int pRightStrength = 2;
  22.                 private int pTickSeparation = 3;
  23.         #endregion
  24.                
  25.                
  26.  
  27.         protected override void Initialize()
  28.         {
  29.                         Add(new Plot(new Pen(Color.Red,12), PlotStyle.TriangleDown, "Highs"));                                 
  30.                         Add(new Plot(new Pen(Color.Blue,12), PlotStyle.TriangleUp, "Lows"));            
  31.                         //PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\Alert4.wav");
  32.                         CalculateOnBarClose     = false;
  33.             Overlay                             = true;
  34.             PriceTypeSupported  = false;
  35.         }
  36.  
  37.         protected override void OnBarUpdate()
  38.         {
  39.                         if(CurrentBar < Math.Max((pLeftStrength+pRightStrength)*3,15))
  40.                                 return;
  41.  
  42.                         if(pType == FractalPivot_TradeStation_Type.Both || pType == FractalPivot_TradeStation_Type.Highs) {
  43.                                 int bar = (int)Pivot_EasyLanguage(1, 1, pLeftStrength, pRightStrength+1, pRightStrength).PivotBarRelative[0];
  44.                                
  45.                                 if(bar>=0) Values[0].Set(pRightStrength, High[pRightStrength]+TickSize * pTickSeparation);
  46.                                
  47.                                
  48.                         }
  49.                         if(pType == FractalPivot_TradeStation_Type.Both || pType == FractalPivot_TradeStation_Type.Lows) {
  50.                                 int bar = (int)Pivot_EasyLanguage(-1, 1, pLeftStrength, pRightStrength+1, pRightStrength).PivotBarRelative[0];
  51.                                
  52.                                 if(bar>=0) Values[1].Set(pRightStrength, Low[pRightStrength]-TickSize * pTickSeparation);
  53.                                
  54.                         }
  55.         }
  56.                
  57.                
  58.                
  59.  
  60.                
  61. //====================================================================
  62.                 #region Properties
  63.  
  64.                 [Description("Ticks separation from bar")]
  65.                 [Category("Visual")]
  66.                 public int TickSeparation
  67.                 {
  68.                         get { return pTickSeparation; }
  69.                         set { pTickSeparation = Math.Max(1,value); }
  70.                 }
  71.  
  72.                 [Description("Left strength")]
  73.                 [Category("Parameters")]
  74.                 public int LeftStrength
  75.                 {
  76.                         get { return pLeftStrength; }
  77.                         set { pLeftStrength = Math.Max(1,value); }
  78.                 }
  79.  
  80.                 [Description("Right strength")]
  81.                 [Category("Parameters")]
  82.                 public int RightStrength
  83.                 {
  84.                         get { return pRightStrength; }
  85.                         set { pRightStrength = Math.Max(1,value); }
  86.                 }
  87.                
  88.                 private FractalPivot_TradeStation_Type pType = FractalPivot_TradeStation_Type.Both;
  89.                 [Description("High prices, Low prices, or both")]
  90.                 [Category("Parameters")]
  91.                 public FractalPivot_TradeStation_Type Type
  92.                 {
  93.                         get { return pType; }
  94.                         set { pType = value; }
  95.                 }
  96.                
  97.                 #endregion
  98.         }
  99. }
  100. public enum FractalPivot_TradeStation_Type {
  101.         Highs,
  102.         Lows,
  103.         Both
  104. }
  105.  
  106. #region NinjaScript generated code. Neither change nor remove.
  107. // This namespace holds all indicators and is required. Do not change it.
  108. namespace NinjaTrader.Indicator
  109. {
  110.     public partial class Indicator : IndicatorBase
  111.     {
  112.         private FractalPivot_TradeStation[] cacheFractalPivot_TradeStation = null;
  113.  
  114.         private static FractalPivot_TradeStation checkFractalPivot_TradeStation = new FractalPivot_TradeStation();
  115.  
  116.         /// <summary>
  117.         ///
  118.         /// </summary>
  119.         /// <returns></returns>
  120.         public FractalPivot_TradeStation FractalPivot_TradeStation(int leftStrength, int rightStrength, FractalPivot_TradeStation_Type type)
  121.         {
  122.             return FractalPivot_TradeStation(Input, leftStrength, rightStrength, type);
  123.         }
  124.  
  125.         /// <summary>
  126.         ///
  127.         /// </summary>
  128.         /// <returns></returns>
  129.         public FractalPivot_TradeStation FractalPivot_TradeStation(Data.IDataSeries input, int leftStrength, int rightStrength, FractalPivot_TradeStation_Type type)
  130.         {
  131.             if (cacheFractalPivot_TradeStation != null)
  132.                 for (int idx = 0; idx < cacheFractalPivot_TradeStation.Length; idx++)
  133.                     if (cacheFractalPivot_TradeStation[idx].LeftStrength == leftStrength && cacheFractalPivot_TradeStation[idx].RightStrength == rightStrength && cacheFractalPivot_TradeStation[idx].Type == type && cacheFractalPivot_TradeStation[idx].EqualsInput(input))
  134.                         return cacheFractalPivot_TradeStation[idx];
  135.  
  136.             lock (checkFractalPivot_TradeStation)
  137.             {
  138.                 checkFractalPivot_TradeStation.LeftStrength = leftStrength;
  139.                 leftStrength = checkFractalPivot_TradeStation.LeftStrength;
  140.                 checkFractalPivot_TradeStation.RightStrength = rightStrength;
  141.                 rightStrength = checkFractalPivot_TradeStation.RightStrength;
  142.                 checkFractalPivot_TradeStation.Type = type;
  143.                 type = checkFractalPivot_TradeStation.Type;
  144.  
  145.                 if (cacheFractalPivot_TradeStation != null)
  146.                     for (int idx = 0; idx < cacheFractalPivot_TradeStation.Length; idx++)
  147.                         if (cacheFractalPivot_TradeStation[idx].LeftStrength == leftStrength && cacheFractalPivot_TradeStation[idx].RightStrength == rightStrength && cacheFractalPivot_TradeStation[idx].Type == type && cacheFractalPivot_TradeStation[idx].EqualsInput(input))
  148.                             return cacheFractalPivot_TradeStation[idx];
  149.  
  150.                 FractalPivot_TradeStation indicator = new FractalPivot_TradeStation();
  151.                 indicator.BarsRequired = BarsRequired;
  152.                 indicator.CalculateOnBarClose = CalculateOnBarClose;
  153. #if NT7
  154.                 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
  155.                 indicator.MaximumBarsLookBack = MaximumBarsLookBack;
  156. #endif
  157.                 indicator.Input = input;
  158.                 indicator.LeftStrength = leftStrength;
  159.                 indicator.RightStrength = rightStrength;
  160.                 indicator.Type = type;
  161.                 Indicators.Add(indicator);
  162.                 indicator.SetUp();
  163.  
  164.                 FractalPivot_TradeStation[] tmp = new FractalPivot_TradeStation[cacheFractalPivot_TradeStation == null ? 1 : cacheFractalPivot_TradeStation.Length + 1];
  165.                 if (cacheFractalPivot_TradeStation != null)
  166.                     cacheFractalPivot_TradeStation.CopyTo(tmp, 0);
  167.                 tmp[tmp.Length - 1] = indicator;
  168.                 cacheFractalPivot_TradeStation = tmp;
  169.                 return indicator;
  170.             }
  171.         }
  172.     }
  173. }
  174.  
  175. // This namespace holds all market analyzer column definitions and is required. Do not change it.
  176. namespace NinjaTrader.MarketAnalyzer
  177. {
  178.     public partial class Column : ColumnBase
  179.     {
  180.         /// <summary>
  181.         ///
  182.         /// </summary>
  183.         /// <returns></returns>
  184.         [Gui.Design.WizardCondition("Indicator")]
  185.         public Indicator.FractalPivot_TradeStation FractalPivot_TradeStation(int leftStrength, int rightStrength, FractalPivot_TradeStation_Type type)
  186.         {
  187.             return _indicator.FractalPivot_TradeStation(Input, leftStrength, rightStrength, type);
  188.         }
  189.  
  190.         /// <summary>
  191.         ///
  192.         /// </summary>
  193.         /// <returns></returns>
  194.         public Indicator.FractalPivot_TradeStation FractalPivot_TradeStation(Data.IDataSeries input, int leftStrength, int rightStrength, FractalPivot_TradeStation_Type type)
  195.         {
  196.             return _indicator.FractalPivot_TradeStation(input, leftStrength, rightStrength, type);
  197.         }
  198.     }
  199. }
  200.  
  201. // This namespace holds all strategies and is required. Do not change it.
  202. namespace NinjaTrader.Strategy
  203. {
  204.     public partial class Strategy : StrategyBase
  205.     {
  206.         /// <summary>
  207.         ///
  208.         /// </summary>
  209.         /// <returns></returns>
  210.         [Gui.Design.WizardCondition("Indicator")]
  211.         public Indicator.FractalPivot_TradeStation FractalPivot_TradeStation(int leftStrength, int rightStrength, FractalPivot_TradeStation_Type type)
  212.         {
  213.             return _indicator.FractalPivot_TradeStation(Input, leftStrength, rightStrength, type);
  214.         }
  215.  
  216.         /// <summary>
  217.         ///
  218.         /// </summary>
  219.         /// <returns></returns>
  220.         public Indicator.FractalPivot_TradeStation FractalPivot_TradeStation(Data.IDataSeries input, int leftStrength, int rightStrength, FractalPivot_TradeStation_Type type)
  221.         {
  222.             if (InInitialize && input == null)
  223.                 throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
  224.  
  225.             return _indicator.FractalPivot_TradeStation(input, leftStrength, rightStrength, type);
  226.         }
  227.     }
  228. }
  229. #endregion



2
General Software Discussion / Re: Fractal Trading Indicator
« on: November 01, 2011, 10:34 PM »
The code is pasted below with the ' Using ' directives'. I have highlighted in RED the Play sound line code for easy reading.

The sound comes on each tick not on alert triangle. It is required only when the alert conditions are met.


-----------------------------------------------------------------------------------------------------------


Code: C# [Select]
  1. #region Using declarations
  2. using System;
  3. using System.Diagnostics;
  4. using System.Drawing;
  5. using System.Drawing.Drawing2D;
  6. using System.ComponentModel;
  7. using System.Xml.Serialization;
  8. using NinjaTrader.Cbi;
  9. using NinjaTrader.Data;
  10. using NinjaTrader.Gui.Chart;
  11. #endregion
  12.  
  13. namespace NinjaTrader.Indicator
  14. {
  15.     [Description("")]
  16.     [Gui.Design.DisplayName("FractalPivot (TradeStation)")]
  17.     public class FractalPivot_TradeStation : Indicator
  18.     {
  19.         #region Variables
  20.                 private int pLeftStrength = 2;
  21.                 private int pRightStrength = 2;
  22.                 private int pTickSeparation = 3;
  23.         #endregion
  24.                
  25.                
  26.  
  27.         protected override void Initialize()
  28.         {
  29.                         Add(new Plot(new Pen(Color.Red,12), PlotStyle.TriangleDown, "Highs"));                                 
  30.                         Add(new Plot(new Pen(Color.Blue,12), PlotStyle.TriangleUp, "Lows"));            
  31.                        
  32.                         CalculateOnBarClose     = false;
  33.             Overlay                             = true;
  34.             PriceTypeSupported  = false;
  35.         }
  36.  
  37.         protected override void OnBarUpdate()
  38.         {
  39.                         if(CurrentBar < Math.Max((pLeftStrength+pRightStrength)*3,15))
  40.                                 return;
  41.  
  42.                         if(pType == FractalPivot_TradeStation_Type.Both || pType == FractalPivot_TradeStation_Type.Highs) {
  43.                                 int bar = (int)Pivot_EasyLanguage(1, 1, pLeftStrength, pRightStrength+1, pRightStrength).PivotBarRelative[0];
  44.                                
  45.                                 if(bar>=0) Values[0].Set(pRightStrength, High[pRightStrength]+TickSize * pTickSeparation);
  46.                                
  47.                                 PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\Alert4.wav");
  48.                                
  49.                                
  50.                         }
  51.                         if(pType == FractalPivot_TradeStation_Type.Both || pType == FractalPivot_TradeStation_Type.Lows) {
  52.                                 int bar = (int)Pivot_EasyLanguage(-1, 1, pLeftStrength, pRightStrength+1, pRightStrength).PivotBarRelative[0];
  53.                                
  54.                                 if(bar>=0) Values[1].Set(pRightStrength, Low[pRightStrength]-TickSize * pTickSeparation);
  55.                                
  56.                         }
  57.         }

3
General Software Discussion / Re: Fractal Trading Indicator
« on: November 01, 2011, 09:10 PM »
Thanks for your quick reply.

I added the code lines. These are highlighted on the attached screenshot.

No sound.

The sound file used by me is good file because I can hear it when clicked directly.

Any help will be much appreciated.


4
General Software Discussion / Re: Fractal Trading Indicator
« on: October 31, 2011, 01:35 PM »
My apologies. I had no intention of making you to read through so many codes of line.

Here are some details as I could assemble in few minutes.
The indicator script is designed to run on Ninja Trader ver 7. (www.ninjatrader.com). Once this script is run, it provides visual signals to buy or sell in market. Please see attached screen shot #01. You will find big red and green triangles there. I wanted to have audio alerts also along with these visual signs. So I added few lines of code reading from the help file of the software. These are shown on attached Screen shot #2 in green. They are showing in green because these did not work as required and they were commented out by me. When these lines were added, the audio alert happened on each tick and not when the visual triangle appeared on the screen. Please also note that there is a companion sub code file associated with this which is included in the zip file (also attached).IT contains all of code lines.

I am willing to show you live working on shared live screen sharing. I am in Toronto, Canada.

Thanks 

5
General Software Discussion / Fractal Trading Indicator
« on: October 31, 2011, 11:53 AM »
I have a "fractal indicator script" which provides Buy or Sell signals on Ninja Trader Platform. It shows visual arrows but does not give any audio alert. I want audio alerts when the visual arrows appear on the screen.

I have attached the script written in C#. I am not a programmer. I will much appreciate if some one can help.

Thanks

Pages: [1]