Can someone explain what this strategy is doing?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
SampleTradeObjects Question
Collapse
X
-
SampleTradeObjects Question
I'm trying to understand the Trade Class usage and in doing so I've tried using the Reference Sample titled "SampleTradeObjects" but it doesn't seem to do what I believe it is supposed to...or perhaps I need further explaining. My understanding is 'lastThreeTrades' is suppossed to increase or decrease by one, depending on a winner or looser respectively. However, when running the strategy, it often trades 4 contracts, sometimes one contract for four times in a row before increasing, etc. Therefore, I've inserted some Print statements to understand what values were being provided for 'lastThreeTrades' and also what value is given for 'lastThreeTrades++' and 'lastThreeTrades--'
Can someone explain what this strategy is doing?Tags: None
-
Tdschulz, I'm not sure where your cs file is taken from but the original example is found here - http://www.ninjatrader.com/support/f...ad.php?t=19289
It would stop trading for the day if you had seen 3 losing trades in a row (reset for each session).
Code:/* If lastThreeTrades = -3, that means the last three trades were all losing trades, don't take anymore trades if this is the case. This counter resets every new session, so it only stops trading for the current day. */ if (lastThreeTrades != -3) { if (Position.MarketPosition == MarketPosition.Flat) { // If a new low is made, enter short if (CurrentDayOHL().CurrentLow[0] < CurrentDayOHL().CurrentLow[1]) EnterShort(); // If a new high is made, enter long else if (CurrentDayOHL().CurrentHigh[0] > CurrentDayOHL().CurrentHigh[1]) EnterLong(); } }
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
52 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
142 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
160 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
96 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
276 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment