NexusFi: Find Your Edge


Home Menu

 





EnterShort() out of an indicator


Discussion in NinjaTrader

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




 
Search this Thread
  #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?
Day 96 Missiles Hit Kuwait and Bahrain: June 15 Peace at …
Prediction Markets & Event Contracts
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
Post-Summit Scorecard: $36M in May 15 Bets Settle Near-Z …
Prediction Markets & Event Contracts
Warsh Opens Today, Hormuz June 19 -- WTI Below $80, Fran …
Prediction Markets & Event Contracts
World Cup Opens: USA at 45.5% Tonight as Markets Push Ba …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
15 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #2 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,972 since Jun 2009
Thanks Given: 534
Thanks Received: 3,720

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


Follow me on X 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
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,972 since Jun 2009
Thanks Given: 534
Thanks Received: 3,720

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 X 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


© 2026 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 - Downloads - Top
no new posts