Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Increment or Counter in the Strategy Builder?
Collapse
X
-
Originally posted by mcosta72 View PostHello WattMan, you can try this:
protected override void OnPositionUpdate(Cbi.Position position, double averagePrice, int quantity, Cbi.MarketPosition marketPosition)
{
if (position.MarketPosition == MarketPosition.Flat)
{
if (SystemPerformance.AllTrades.Count >= 1)
{
Trade lastTrade = SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1] ;
double res = lastRTTrade.ProfitCurrency * lastRTTrade.Quantity;
if(res < 0)
stop += 1;
if(res > 0)
target += 1;
}
}
}
Comment
-
Originally posted by lovelean View Post
Can anyone tell me how I can do this in Strategy Builder?
- Likes 1
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by aligator, 01-06-2022, 12:14 PM
|
4 responses
237 views
0 likes
|
Last Post
by john_44573
Today, 06:11 PM
|
||
Started by reynoldsn, Today, 05:56 PM
|
0 responses
8 views
0 likes
|
Last Post
by reynoldsn
Today, 05:56 PM
|
||
Started by bortz, 11-06-2023, 08:04 AM
|
51 responses
1,990 views
0 likes
|
Last Post
by aligator
Today, 05:50 PM
|
||
Started by dmking, 11-12-2019, 12:31 PM
|
4 responses
4,152 views
0 likes
|
Last Post
by jasonw
Today, 04:32 PM
|
||
Started by roblogic, Today, 04:31 PM
|
0 responses
11 views
0 likes
|
Last Post
by roblogic
Today, 04:31 PM
|
Comment