NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 07-11-2012, 05:39 AM   #1
daglas
Senior Member
 
Join Date: Mar 2011
Location: Ukraine
Posts: 146
Thanks: 19
Thanked 2 times in 2 posts
Default troubles with market orders

Dear friends.
I have troubles with placeing market orders with my strategies.
I have test on my PC and on my Notebook.
I can't find even orders from my strategy.
I have try sell and buy market orders. And got nothing.
I have wrote simple strategy
Code:
        protected override void OnBarUpdate()
        {
            EnterLong(1,"buy");
            EnterLong();
            Print("EnterLong");
        }
But it works only on strategy tester. I have reset simulator few times. And reload terminal, but got nothing.
daglas is offline  
Reply With Quote
Old 07-11-2012, 05:56 AM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello daglas,
You have placed 2 long orders. Depending on your Entry handling/Entries per direction, one order may get cancelled.

Since there are no condition filters and no exit/sell orders, the order(s) will be placed on the first bar of session (provided you have Exit on close set to true) and your strategy will remain in yellow state.

Quote:
Yellow highlighted "Strategy" cell indicates the strategy is waiting until it reaches a flat position to be in sync with the account position before fully starting. (Please see the options Strategies Tab section for configuration options)
http://www.ninjatrader.com/support/h...egies_tab2.htm
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 07-11-2012, 06:18 AM   #3
daglas
Senior Member
 
Join Date: Mar 2011
Location: Ukraine
Posts: 146
Thanks: 19
Thanked 2 times in 2 posts
Default

How can I create a simple strategy which will open short / long position, at each new bar?
For example, I want to open long order at each new bar, because I know that price will rising. What should I do?
I will close position manually,when I decide that profit size is enough for me.
daglas is offline  
Reply With Quote
Old 07-11-2012, 06:33 AM   #4
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello daglas,
Unfortunately we cannot create this strategy code for you. We can however assist with specific questions you may have or issues you run into coding this yourself.

Specifically for your question you would use EnterLong() for example inside of OnBarUpdate(). A sample of NinjaScript programming can be found here: http://www.ninjatrader.com/support/h..._cross_ove.htm

You would replace the crossover logic here for what you want to happen. If you want it on each new bar just removing the crossover check will be fine.

I would also have a if(Historical) return; to the code so that it only runs when you enable it live.

http://www.ninjatrader.com/support/h...historical.htm

To develop your custom indicator/strategies you can contact any of our independent NinjaScript consultants as well to do this code for you. You can get the list of our NinjaScript consultants from here http://www.ninjatrader.com/partners#...pt-Consultants
Last edited by NinjaTrader_Brett; 07-11-2012 at 07:55 AM.
NinjaTrader_Joydeep is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
troubles with saving opened orders and perfomance data daglas General Programming 1 06-21-2012 11:07 AM
Troubles with instruments Emanuele67 Connecting 3 05-16-2012 09:40 AM
troubles with export daglas General Programming 1 04-20-2011 11:14 AM
Troubles with intraday data jimmy.jared Connecting 3 04-18-2011 03:52 AM
troubles DataSeries Nikoli Indicator Development 15 04-06-2010 10:19 AM


All times are GMT -6. The time now is 07:54 PM.