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 SalmaTrader, 07-07-2026, 10:26 PM
|
0 responses
47 views
0 likes
|
Last Post
by SalmaTrader
07-07-2026, 10:26 PM
|
||
|
Started by CarlTrading, 07-05-2026, 01:16 PM
|
0 responses
22 views
0 likes
|
Last Post
by CarlTrading
07-05-2026, 01:16 PM
|
||
|
Started by CaptainJack, 06-17-2026, 10:32 AM
|
0 responses
15 views
0 likes
|
Last Post
by CaptainJack
06-17-2026, 10:32 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:15 AM
|
0 responses
21 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:15 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:06 AM
|
0 responses
23 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:06 AM
|

Comment