PDA

View Full Version : scale into order based on price and adjust profit target??


1reason
02-11-2010, 09:53 PM
Hi,

I want to fade a stock moving higher with preset entries based on the previous bar. Sudo code would be like this
1. if last price > high of last bar and
price = high of the day and
current bar (5 min) is not first bar of day and
current bar (5min) is not > than the 10th bar of the day then
1. sell limit order X # of shares at price of last bar + .02 and
2. sell limit 100 shares every .25 higher
end if

-ALSO- I need a profit target
so upon the first order being fullfilled a buy to cover limit order of .50 to be entered and for each additional 100 shares sold higher a CHANGE in the profit target order price and quantity to reflect the total amount of shares short AND the current average price of the shares sold. I want to maintain the profit target of .50 per share but have the actual limit price move higher as my average cost basis goes higher with each additional short.

I would like to be able to do this on NT7 as that appears to be coming out shortly.

Any direction would be great so that I can start using ninja to automate my trading.

Thank you

Robert

NinjaTrader_Bertrand
02-12-2010, 06:28 AM
Robert, you would need to custom code this via NinjaScript programming - for the basic conditions, you can work with Close (lastprice), High and CurrentDayOHL (high of day) -

http://www.ninjatrader-support.com/HelpGuideV6/CurrentDayOHL.html

To access the bar count, use CurrentBar -

http://www.ninjatrader-support.com/HelpGuideV6/CurrentBar.html

Do you want to issue scale in orders until a certain size is filled?

You can use Position.Quantity to check for this - http://www.ninjatrader-support.com/HelpGuideV6/Quantity.html

For the Profit Target, you can use SetProfitTarget while ensuring to use uniquely named entry orders that you can tie the targets to.

You can move targets and stops with this sample concepts -

http://www.ninjatrader-support2.com/vb/showthread.php?t=3222