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-
Let me know if I can be of further assistance.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.
http://www.ninjatrader.com/support/h...rlonglimit.htmCode:EnterLongLimit(storedValue + 2 * TickSize);
Cal H.NinjaTrader Customer Service
Comment
-
Rising( sma) would always happen so the stored value is always updated. .hence close never gets above it by 2 ticks.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
-
because your first statement is looking for a cross below of two exact same T3s, thus no cross below...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 likeit still does not enter trades based on my TickSize setting. Please note I am using EURUSD.Code:if(SMA(14)[1] > if(SMA(14)[2] && SMA(14)[0] < if(SMA(14)[1] )
Comment
-
What tasker said.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 likeit still does not enter trades based on my TickSize setting. Please note I am using EURUSD.Code: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
-
&& CrossBelow(T3(100, 3, 0.7), T3(200, 3, 0.7)[1], 1))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
-
Put a Print() or Draw...() statement in your order block to verify that it even gets entered. You conditions look so restrictive that I think you are not even entering the block at all.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 argusthome, 03-08-2026, 10:06 AM
|
0 responses
61 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
40 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
21 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
23 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
51 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment