protected override void Initialize()
{
Add("^SP500", PeriodType.Day, 1);
SetStopLoss("", CalculationMode.Percent, 10, false);
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
if (IsIndexCloseHigherThenAverageIndexClose &&
IsHighHigherThenAverageClose &&
IsHighHigherThenHighestHigh)
EnterLong();
if (IsLowLowerThenLowestLow)
ExitLong();
}
private bool IsIndexCloseHigherThenAverageIndexClose
{
get
{
return Closes[1][0] > SMA(BarsArray[1], 200).Close[0];
}
}
private bool IsHighHigherThenAverageClose
{
get
{
return High[0] > SMA(High, 200)[0];
}
}
private bool IsHighHigherThenHighestHigh
{
get
{
return High[0] > MAX(High, 50)[1];
}
}
private bool IsLowLowerThenLowestLow
{
get
{
return Low[0] < MIN(Low, 20)[1];
}
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Adding to a long position?
Collapse
X
-
Adding to a long position?
Let say I use this strategy to enter a long position:
But now after I have enter a long position I wanna add more to the long position when its go up 5% of the initial long position and I wanna do this 5 times. How can I do it?Code:Tags: None
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
213 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
126 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
145 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
229 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
190 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment