Thank you in advance.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to do this?
Collapse
X
-
How to do this?
I have an idea for a strategy but need help figuring out how to implement a certain function. I want to enter a trade when Close is above a set number of ticks from when a MA started to rise. So I would have to store the last price of when MA went from falling to rising and then enter a trade once my set number of ticks above that MA is reached. How would I do this?
Thank you in advance.Tags: None
-
Relogical,
Thank you for your post.
The example below should give an outline of how to accomplish this-
Code:if(Rising(SMA(14))) { storedValue = SMA(14)[0]; } if(Close[0] > storedValue + 2 * TickSize) { EnterLong(); }
Cal H.NinjaTrader Customer Service
-
I can't seem to get it to enter a trade when Close is > then my tick setting. I am using Forex. Are the ticks sizes the same as in stocks or is it something else? I have tried setting from .001 to 10000 and nothing works. Positions are being entered anyway. Is there anything I need to do extra?Last edited by relogical; 03-06-2014, 12:18 PM.
Comment
-
You can try using limit orders.
The example I gave you submits a Market Order.
Code:EnterLongLimit(storedValue + 2 * TickSize);
Cal H.NinjaTrader Customer Service
Comment
-
Originally posted by relogical View PostBut doing a limit order won't work if I want to enter a position on a MA crossover. I have tried both ways and it's just not entering a position where I specify. It's almost like it not storing storedValue.
Comment
-
Here's my code. Please tell me why it;s not entering trades on my signal. Thank you
Code:// Start Long if (CrossBelow(T3(500, 3, 0.7), T3(500, 3, 0.7),1)) { storedValue1 = T3(500, 3, 0.7)[0]; } if (Position.MarketPosition == MarketPosition.Flat && Close[0] < storedValue1 - 100 * TickSize && CrossBelow(T3(100, 3, 0.7), T3(200, 3, 0.7), 1)) { EnterLong(DefaultQuantity, "Start Long"); }
Comment
-
Originally posted by relogical View PostHere's my code. Please tell me why it;s not entering trades on my signal. Thank you
Code:// Start Long if (CrossBelow(T3(500, 3, 0.7), T3(500, 3, 0.7),1)) { storedValue1 = T3(500, 3, 0.7)[0]; } if (Position.MarketPosition == MarketPosition.Flat && Close[0] < storedValue1 - 100 * TickSize && CrossBelow(T3(100, 3, 0.7), T3(200, 3, 0.7), 1)) { EnterLong(DefaultQuantity, "Start Long"); }
Comment
-
That crossover is correct because it's looking for T3 to be lower then T3 one bar ago. But even if I change that to something else likeCode:if(SMA(14)[1] > if(SMA(14)[2] && SMA(14)[0] < if(SMA(14)[1] )
Comment
-
Originally posted by relogical View PostThat crossover is correct because it's looking for T3 to be lower then T3 one bar ago. But even if I change that to something else likeCode:if(SMA(14)[1] > if(SMA(14)[2] && SMA(14)[0] < if(SMA(14)[1] )
If it was correct it would be working :-)
It doesn't work the way you are thinking it does.
Try T3(500,3,0.7)[1] as one of the parameters.Last edited by sledge; 03-06-2014, 05:36 PM.
Comment
-
Originally posted by relogical View PostI really appreciate the help but how is that supposed to work if I only use T3(500,3,0.7)[1] as the only parameter? I am trying to store the price at the point of when T3 500 started to fall.
You probably will need a currentbar check if you don't have one.
Comment
-
I don't see how that code determines the point at which T3(500, 3, 0.7) is beginning to fall. My example does that (see below). My issue is that the entrees are done without considering my TickSize distance.
if(T3(500, 3, 0.7)[1] > if(T3(500, 3, 0.7)[2]
&& T3(500, 3, 0.7)[0] < if(T3(500, 3, 0.7)[1] )
Comment
-
Originally posted by relogical View PostHere's my code. Please tell me why it;s not entering trades on my signal. Thank you
Code:// Start Long if (CrossBelow(T3(500, 3, 0.7), T3(500, 3, 0.7),1)) { storedValue1 = T3(500, 3, 0.7)[0]; } if (Position.MarketPosition == MarketPosition.Flat && Close[0] < storedValue1 - 100 * TickSize && CrossBelow(T3(100, 3, 0.7), T3(200, 3, 0.7), 1)) { EnterLong(DefaultQuantity, "Start Long"); }
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by f.saeidi, Today, 12:12 AM
|
0 responses
2 views
0 likes
|
Last Post
by f.saeidi
Today, 12:12 AM
|
||
Started by Conall, Today, 12:06 AM
|
0 responses
4 views
0 likes
|
Last Post
by Conall
Today, 12:06 AM
|
||
Started by proptradingshop, 03-21-2024, 09:50 AM
|
6 responses
27 views
0 likes
|
Last Post Today, 12:02 AM | ||
Started by mly916, Yesterday, 09:48 PM
|
1 response
11 views
0 likes
|
Last Post Yesterday, 11:54 PM | ||
Started by Mikey_, Yesterday, 09:21 PM
|
0 responses
11 views
0 likes
|
Last Post
by Mikey_
Yesterday, 09:21 PM
|
Comment