Thanks!
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Displacement parameter
Collapse
X
-
-
Thanks gregid, but I only know the very basics of programming so I wouldn't know how to implement this, when I'm looking at the code though, it looks like it might be the same function as "bars ago" in strategy builder wizard.
Update: I've tried the bars ago parameter, but then when I backtest the strategy it doesn't generate any trade and the displaced SMA isn't even shown on the chart.
Update 2: When I try adding the above code to the strategy I get an error message: The name 'Displacement' does not exist in the current contextLast edited by George09; 07-10-2011, 02:08 AM.
Comment
-
George, the Displacement property would only be for indicators visually - in your strategy you would reference to a certain series value x bars ago to create the same effect - do you see any errors in the log tab if you apply your script to the chart you're testing on? If you attach it here we could take a quick look at it as well then and guide further.
Thanks,BertrandNinjaTrader Customer Service
Comment
-
Grrrr, sry guys, just found out the problem was that I didn't have any open data connection, so that's why it didn't generate any trade, thanks for your help though!
BTW, Do you know where I can find a code that would execute profit target on SMA cross? As far as I know it's possible to set only fixed profit targets in strategy wizard.
Comment
-
I've tried to edit the original script from wizard, where T/P was fixed:
SetProfitTarget("", CrossBelow(EMA(34), EMA(50), 1));
The best overloaded method match for 'NinjaTrader.Strategy.StrategyBase.CrossBelow(doub le, NinjaTrader.Data.IDataSeries, int)' has some invalid arguments Argument '2': cannot convert from 'double' to 'NinjaTrader.Data.IDataSeries' The best overloaded method match for 'NinjaTrader.Strategy.StrategyBase.SetProfitTarget (NinjaTrader.Strategy.CalculationMode, double)' has some invalid arguments Argument '1': cannot convert from 'string' to 'NinjaTrader.Strategy.CalculationMode' Argument '2': cannot convert from 'bool' to 'double'
Comment
-
George09,
That line of code will not work.
CrossBelow() does not return a price value. It returns either true or false for if something crossed below something else.
If you want to try and set a new profit target price when something crossed below something else you need to do this:
Code:if (CrossBelow(EMA(34), EMA(50), 1)) SetProfitTarget(CalculationMode.Price, somePriceLevel);
Josh P.NinjaTrader Customer Service
Comment
-
Hi, thanks for the info Josh. Actually I don't really need to set a new profit target when 2 EMAs cross, but I would rater have the crossing point as profit target. So I this case, should I use this code:
if (CrossBelow(EMA(34), EMA(50), 1)) SetProfitTarget(CalculationMode.Ticks, 0);
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by claxxical, 05-30-2017, 12:30 PM
|
37 responses
4,453 views
0 likes
|
Last Post
by Padan
Today, 02:23 AM
|
||
Started by SugarDefwebsite, Today, 02:18 AM
|
0 responses
3 views
0 likes
|
Last Post Today, 02:18 AM | ||
Started by usglucofreeze, Today, 01:19 AM
|
0 responses
7 views
0 likes
|
Last Post Today, 01:19 AM | ||
Started by f.saeidi, Today, 01:12 AM
|
0 responses
14 views
0 likes
|
Last Post
by f.saeidi
Today, 01:12 AM
|
||
Started by NinjaTrader_ChelseaB, 03-14-2017, 10:17 AM
|
227 responses
34,319 views
7 likes
|
Last Post
by rare312
Today, 12:51 AM
|
Comment