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
Stoploss and Profittarget Problem
Collapse
X
-
Sorry Bertrand. is this "#" the rhomb symbol you are talking about? when you say wrap code tags around it, do you mean that I paste the code inbetween "Code:" and "
Leave a comment:
-
Just wrap code tags around it...the rhomb symbol when you post...
Looks then like below -
Code:MyCodeIsHappyInThisBox
Leave a comment:
-
i have no error,
if i run the script with setstoploss and setprofittarget only Profittargt will filled. No Stoploss will triggered. I i run
if (Position.MarketPosition == MarketPosition.Long)
// SetProfitTarget(CalculationMode.Price, Position.AvgPrice + range);
SetStopLoss(CalculationMode.Price, Position.AvgPrice - range);
i have an Entry and after this the position will be stopped out but not with the right range.
Leave a comment:
-
What error do you get with the targets? You would need to reset those as well when flat...
Leave a comment:
-
Thx bertrand
entry and PT work, SL don´t work
Here is my Code
Code:protected override void OnBarUpdate() { // Condition set 1 if (Position.MarketPosition == MarketPosition.Flat) { SetProfitTarget(CalculationMode.Ticks, 20); } if (entry condition) { range = Math.Abs(High[0] - Low[0]); EnterLong(); } if (Position.MarketPosition == MarketPosition.Long) SetProfitTarget(CalculationMode.Price, Position.AvgPrice + range); SetStopLoss(CalculationMode.Price, Position.AvgPrice - range); }
Last edited by thunderbolt78; 03-02-2010, 06:59 AM.
Leave a comment:
-
Sorry, I'm not aware of a direct sample for this, the general idea is like demonstrated in this snippet below -
Code:if (Position.MarketPosition == MarketPosition.Flat) { SetProfitTarget(CalculationMode.Ticks, 20); } if (CrossAbove(SMA(Fast), SMA(Slow), 1)) { range = Math.Abs(High[1] - Low[1]); EnterLong(); } if (Position.MarketPosition == MarketPosition.Long) SetProfitTarget(CalculationMode.Price, Position.AvgPrice + range);
Leave a comment:
-
hi this is what i´m locking for, but i have no idea how i make this ?
is there a reference oder a code sample ? Sorry ..
Leave a comment:
-
You would need to custom code to achieve this - record the range of your entry bar at time of entry and then call SetStopLoss / SetProfitTarget to place the exit bracket at your desired values.
Leave a comment:
-
hi,
thanks for your fast reply, but if i use the normal setstoploss ans setprofittarget i can only use normal values.
i the 30 min bar 40 ticks i need 40 ticks stop and profit from entry if the bar has got 30 ticks i need 30 ticks SL and PT. How i can set the ticksize of PT and SL to the ticksize of my entrybar ?
Leave a comment:
-
You could directly use SetProfitTarget and SetStopLoss set to CalculationMode.Ticks for this, as they would automatically reference your entryPrice directly when issuing the needed bracket orders (those Set Methods would be OCO'ed as well).
Leave a comment:
-
Stoploss and Profittarget Problem
Hi there, i have read many Hours in this forum, but i don´t find a solution.
Here is my problem
i will trade a 30 min bar. the ATR of this bar is 20 ticks for example. If i enter this bar i will make a profit target of this 20 ticks. I will make a stoploss of this 20 ticks. The Position will be stopped out or will go in profit. If the Position is closed, with or without Profit the next bar has a range of 15 ticks for example. So i need a PT of entry + 15 and a Stoploss of Entry -15. How can i make this ?
please help meTags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by usazencort, Today, 01:16 AM
|
0 responses
1 view
0 likes
|
Last Post
by usazencort
Today, 01:16 AM
|
||
Started by kaywai, 09-01-2023, 08:44 PM
|
5 responses
602 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by xiinteractive, 04-09-2024, 08:08 AM
|
6 responses
22 views
0 likes
|
Last Post Today, 12:31 AM | ||
Started by Pattontje, Yesterday, 02:10 PM
|
2 responses
20 views
0 likes
|
Last Post
by Pattontje
Yesterday, 11:49 PM
|
||
Started by flybuzz, 04-21-2024, 04:07 PM
|
17 responses
230 views
0 likes
|
Last Post
by TradingLoss
Yesterday, 11:45 PM
|
Leave a comment: