Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Multiple profit targets and BE point - BigMike
Collapse
X
-
That is because I simply corrected the error that was posted, which arose because of the missing index. I did not check the syntax of your entire statement. Maybe I should have. Yes, there is no overload that uses 3 parameters.Originally posted by calhawk01 View Post
-
so I guess i Should just hide in a corner and start crying :/Originally posted by koganam View PostThat is because I simply corrected the error that was posted, which arose because of the missing index. I did not check the syntax of your entire statement. Maybe I should have. Yes, there is no overload that uses 3 parameters.
wish i would had taken programming classes in college
CAL do you know how to solve this problem?Last edited by staycool3_a; 05-16-2013, 12:52 PM.
Comment
-
Calhawk01,
An overload is the number of arguments available to write the SetStopLoss() function.
Take a look at the online help guide link below -
http://www.ninjatrader.com/support/h...etstoploss.htm
You'll notice that there are four different ways to write it. These are called overloads and each overload has a certain number of arguments that are being used. The first line in the help guide is using 2 arguments, each one separated by a comma. What Koganam was trying to explain is that with the added quotes, " ", in the code line it will produce an overload error because it would create three arguments and there is no overload that uses three arguments. If you remove those quotes and the proceeding comma, you will have working code when compiled.
Example:
From your code you are also calling the SetStopLoss in the initialize section with the Position.AvgPriceCode:SetStopLoss(CalculationMode.Price, (Position.AvgPrice - (CurrentDayOHL().CurrentOpen[0] - (1 * TickSize))));
However, the initialize is called once and before the conditions. The Position.AvgPrice grabs the current positions price, however this is called before you are in a position and will not set a stop loss for you.
I have attached a couple references that you can use to help along with the coding part.
The first one is modifying your stop loss and profit targets
http://www.ninjatrader.com/support/f...ead.php?t=3222
The second is on Automated Strategy Development from our YouTube library.
http://www.youtube.com/watch?v=SpwGT...DD7105&index=6
Please let me know if I can be of further assistance.Cal H.NinjaTrader Customer Service
Comment
-
.... this is super frustrating.. i've spent ALL DAY trying to figure out how to set my stoploss ONE CENT or ONE TICK below the stock's OPENING price.. AND I still have no solutions.............................
SetStopLoss(CalculationMode.Price, CurrentDayOHL().CurrentOpen[0]-.01);
I'm getting the same behavior even if I take the Position.AvgPrice out... the strategy compiles correctly, but when I select the strategy in backtesting or realtime strategy, the settings are behaving in an abnormal fashion (other strategy's settings are applied to this strategy, and when I backtest, other strategies are being backtested rather than this)Last edited by staycool3_a; 05-16-2013, 02:11 PM.
Comment
-
Calhawk01,
I have provided a sample of what the strategy should look like.
You need to download and import this strategy.
To Import
* Download the indicator to your desktop, keep them in the compressed .zip file.
* From the Control Center window select the menu File> Utilities> Import NinjaScript
* Select the downloaded .zip file
* NinjaTrader will then confirm if the import has been successful.
Critical - Specifically for some indicators, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'
Please let me know if I can be of further assistanceAttached FilesCal H.NinjaTrader Customer Service
Comment
-
CAL, thank you so much. I will try this out during market hour tomorrow to see how it behaves.
Will get back to you.
Comment
-
The order, profit target, and stop loss is being sent at the same time.Originally posted by calhawk01 View PostCAL, thank you so much. I will try this out during market hour tomorrow to see how it behaves.
Will get back to you.
However, the stop loss is being calculated incorrectly.
Using ES 06-13 market replay.. 5/13/2013 at 9:48AM the orders:
entry= 1624.75
stop loss = 1219 <--- that is NOT 1 tick away from opening price for the day
profit target= is correct
I'm using the same template as you sent me.
Code:{ EnterLongLimit(DefaultQuantity, Close[0], ""); SetStopLoss(CalculationMode.Ticks, CurrentDayOHL().CurrentOpen[0] - 1); }
Comment
-
I'm pretty sure that's b/c it's a futures contract and the opening price for it is being taken from 2012
Comment
-
Calhawk01,
Try changing the SetStopLoss to have a calculation mode set to Price and have the 1*ticksize.
Something like this -
This should get the Stop Loss price that you are looking for.Code:SetStopLoss(CalculationMode.Price, CurrentDayOHL().CurrentOpen[0] - (1 * TickSize));
Please let me know if I can be of further assistance.Attached FilesCal H.NinjaTrader Customer Service
Comment
-
-
Ok so, need some opinions
time series:
t0= long at 100
stoploss set at 99.95
t1= 100.19
t2= 100.20
t3= BAD tick 99.94, correct tick 100.22
stoploss hit on t3, and sell occurred at 100.22 even though i had a limit order at 99.95
so two things, First, how to deal with bad ticks? b/c my stoploss should never have had occured since at t3 there was a bad tick. Second, even though I would not have wanted this to happen, shouldn't my sell have had occured on the bad tick at 99.94? (in reality, no b/c usually bad ticks are micro lots, and my shares > microlots)
any ideas on how to deal w/ bad ticks?
Comment
-
Calhawk01,
You can enable the Bad Tick filter through the options menu.- Tools>Options>Data Tab
- Enable 'Filter Bad Ticks' and choose a percentage off the market you want to filter out.
You can also edit the historical data to fix a bad tick.- Open Historical Data Manager – Control Center>Tools>Historical Data Manager
- Click Edit Tab. From here you can select different instruments that you want to add missing info to.
- Select the instrument you want to adjust
- You can select the Ask, Bid, or Last
- Select Minute, Tick, or Day
- Select the Month
- Select the Date and time frame
- Select the bad tick row
- Enter in the missing/bad info
For the bad tick and StopLoss, the sell order was placed at 99.94 but got filled at a better price, 100.22.
Below is a link to our online help guide that explains how to edit historical data in the Historical Data Manager
http://www.ninjatrader.com/support/h...ml?editing.htm
Let me know if I can be of further assistanceCal H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by argusthome, Yesterday, 10:06 AM
|
0 responses
17 views
0 likes
|
Last Post
by argusthome
Yesterday, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
16 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
14 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
9 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
36 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment