Trading Articles
Article Categories
Article Tools
EnterShort() out of an indicator
Updated December 30, 2014
trending_up
1,079 views
thumb_up
4 thanks given
group
3 followers
forum
5 posts
attach_file
0 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
EnterShort() out of an indicator
(login for full post details)
#1 (permalink )
Bremen
Posts: 3 since Dec 2014
Thanks: 5 given,
0
received
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
Can you help answer these questions from other members on futures io?
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#2 (permalink )
OC, California, USA
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,958 since Jun 2009
Thanks: 528 given,
3,648
received
Only strategies can place orders. Indicators cannot place orders. You need to write a strategy.
The following user says Thank You to shodson for this post:
(login for full post details)
#3 (permalink )
Bremen
Posts: 3 since Dec 2014
Thanks: 5 given,
0
received
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
}
}
(login for full post details)
#4 (permalink )
OC, California, USA
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,958 since Jun 2009
Thanks: 528 given,
3,648
received
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
The following user says Thank You to shodson for this post:
(login for full post details)
#5 (permalink )
Perth + WA/Australia, Sydney and Manila
Experience: Advanced
Platform: NinjaTrader Optionvue
Broker: NinjaTrader Continuum and Kinetick
Trading: ES, CL, GC
Posts: 57 since Jun 2013
Thanks: 1 given,
25
received
This is probably not what you want to hear, but I would concern myself more with market structure than indicators.
The following 2 users say Thank You to AnyM for this post:
(login for full post details)
#6 (permalink )
Bremen
Posts: 3 since Dec 2014
Thanks: 5 given,
0
received
i have written a strategy now and works fine for me.
Thanks for reply to my thread !
Last Updated on December 30, 2014
Right now
Ongoing
Right now
March
Register to Attend
Elite only
Coming soon
April