![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Jun 2010
Location: gold coast australia
Posts: 92
Thanks: 15
Thanked 6 times in 5 posts
|
Hi Guys,
I am having a problem with multiple entires. When I use the term Firstentry it sets the stop to my entry price not the danchain chanel low. If I dont use the entry name it ignores the stop. If I dont use an entry name when I enter its ok. Code:
// If a long position is open, allow for stop loss modification to breakeven
else if (Position.MarketPosition == MarketPosition.Long)
{
barcounter = barcounter +1 ;
if (DonchianChannel(stoptrail).Lower[1]> Position.AvgPrice)
{
SetStopLoss("Firstentry", CalculationMode.Price, DonchianChannel(stoptrail).Lower[1] - stoptrailoffset* TickSize , false);
//SetStopLoss("Secondentry", CalculationMode.Price, DonchianChannel(stoptrail).Lower[1] - stoptrailoffset* TickSize , false);
//Print("Firstentry last value= "+(DonchianChannel(stoptrail).Lower[1] - stoptrailoffset* TickSize) + " " + Close[0]+ " " +(Time[0].ToString()) );
}
}
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
raefon,
The "Firstentry" would tie that stop loss to the entry that has entrance signal string "Firstentry". What is stoptrailoffset? How is it defined?
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Jun 2010
Location: gold coast australia
Posts: 92
Thanks: 15
Thanked 6 times in 5 posts
|
Stoptrailoffset is a private int variable. Its an offset below the low period. Its the entry name that seems to be the problem however.
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
raefon,
Could you post more of our code?
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Jun 2010
Location: gold coast australia
Posts: 92
Thanks: 15
Thanked 6 times in 5 posts
|
attached as zip
|
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Apr 2012
Posts: 1
Thanks: 0
Thanked 0 times in 0 posts
|
hi,
am also get some problem in stop loss.how may i solve this . |
|
|
|
|
|
#7 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
raefon,
DonchianChannel(stoptrail).Lower[1]> Position.AvgPrice The DonchainChannel is not necessarily greater than the Position.AvgPrice initially. You would want to set an initial stop loss before you enter the trade.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
ramfx,
If you could post your code I'd be happy to take a quick look.
Adam P.
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do I change the stop-loss order into a stop-loss-limit order? | op684 | ATM Strategies (Discretionary Trading) | 10 | 01-23-2011 03:02 AM |
| Turning on and off the trailing stop feature of a stop loss set by an ATM | ohowie | ATM Strategies (Discretionary Trading) | 2 | 01-12-2011 03:19 AM |
| Stop market order for stop loss submitted by NinjaScript-created ATM strategy | cyrotiv | Strategy Development | 6 | 10-05-2009 11:03 AM |
| Order Entry Property: Use stop market for stop loss orders | higler | SuperDOM and other Order Entry Windows | 7 | 07-02-2007 09:06 AM |
| Stop Loss Orders activated by number of trades past stop level | DoveforUsAll | Suggestions And Feedback | 1 | 02-08-2006 01:19 AM |