NexusFi: Find Your Edge


Home Menu

 





EnterShort() out of an indicator


Discussion in NinjaTrader

Updated
    1. trending_up 1,552 views
    2. thumb_up 4 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

EnterShort() out of an indicator

  #1 (permalink)
excess
Bremen
 
Posts: 3 since Dec 2014
Thanks Given: 5
Thanks Received: 0

Hello traders,

i am a new user of ninjaTrader and i am writing my own little indicator.
Now i want to automate it an try to make calls to EnterShort() or EnterLong() ...

but sadly i get the compile error : CS0103


the call from an strategy is possible

thanks and greetings

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
How to apply profiles
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
34 thanks
Just another trading journal: PA, Wyckoff & Trends
30 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #2 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
Quantoholic
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,976 since Jun 2009
Thanks Given: 533
Thanks Received: 3,709

Only strategies can place orders. Indicators cannot place orders. You need to write a strategy.

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
excess
Bremen
 
Posts: 3 since Dec 2014
Thanks Given: 5
Thanks Received: 0


thank u for the answer.
have nice Christmastime !

i have tryed to port the indicator to an strategy, but without the full succes

i have written now a Strategy, like you recommended to me

now i need one value (of the member UpTrend ) of the indicator TSSuperTrend in my stategy.
but i do not know how to reference that one. the try to reference it like i successfull do with the SMA does not work

i hope somebody understand my problem despite my bad english

 
Code
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
	/// <summary>
	/// Enter the description of your strategy here
	/// </summary>
	[Description("Enter the description of your strategy here")]
	public class MyStrategy : Strategy
	{
		#region Variables
			private DataSeries		diff;
		#endregion

		/// <summary>
		/// This method is used to configure the strategy and is called once before any strategy method is called.
		/// </summary>
		protected override void Initialize()
		{
			diff				= new DataSeries(this);
			CalculateOnBarClose = false;
			ClearOutputWindow();
		}

		/// <summary>
		/// Called on each bar update event (incoming tick)
		/// </summary>
		protected override void OnBarUpdate()
		{
			if(CurrentBar < 30){
				return;
			}

			double FA = SMA(Close, 3)[0];
			double SA = SMA(Close, 10)[0];

			double val = (FA - SA) / TickSize;

			diff.Set(val);

			if (Rising(diff)){
				Print(Time[0] + "  #  upTrend   #  " +  Math.Round(val));
			}
			else{
				Print(Time[0] + "  #  downTrend    #  " +  Math.Round(val));
			}

			// the folowing line Print(...) produces compiler error : NinjaTrader.Strategy.Strategy.TSSuperTrend(int, TSSuperTrend.Utility.MovingAverageType, double, int, TSSuperTrend.Utility.SuperTrendMode)' is a 'method', which is not valid in the given context

			Print(TSSuperTrend(14, TSSuperTrend.Utility.MovingAverageType.SMA, 2.618, 14, TSSuperTrend.Utility.SuperTrendMode.ATR).UpTrend[0]);
		}

		#region Properties
		#endregion
	}
}

Reply With Quote
  #4 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
Quantoholic
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,976 since Jun 2009
Thanks Given: 533
Thanks Received: 3,709

After downloading and installing this version of TSSuperTrend, this code compiles fine

 
Code
Print(TSSuperTrendV2_4(14, TSSuperTrend.Utility.MovingAverageType.SMA, 2.618, 14, TSSuperTrend.Utility.SuperTrendMode.ATR).UpTrend[0]);
I'm not sure which one you are using

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #5 (permalink)
 AnyM 
Bangkok, Thailand
 
Experience: None
Platform: Ninjatrader 8
Broker: NT Continuum TastyWorks
Trading: ES
Posts: 65 since Jun 2013
Thanks Given: 2
Thanks Received: 33

This is probably not what you want to hear, but I would concern myself more with market structure than indicators.

Reply With Quote
Thanked by:
  #6 (permalink)
excess
Bremen
 
Posts: 3 since Dec 2014
Thanks Given: 5
Thanks Received: 0

i have written a strategy now and works fine for me.

Thanks for reply to my thread !

Reply With Quote




Last Updated on December 30, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts