NexusFi: Find Your Edge


Home Menu

 





program a limit order in a strategy


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one bob998 with 6 posts (0 thanks)
    2. looks_two monpere with 5 posts (0 thanks)
    3. looks_3 NinjaTrader with 3 posts (6 thanks)
    4. looks_4 MWinfrey with 1 posts (0 thanks)
    1. trending_up 8,786 views
    2. thumb_up 7 thanks given
    3. group 6 followers
    1. forum 18 posts
    2. attach_file 0 attachments




 
Search this Thread

program a limit order in a strategy

  #1 (permalink)
 bob998 
West Palm Beach, FL
 
Experience: Intermediate
Platform: Ninja
Trading: TF, NQ ES,CL,6E
Posts: 6 since Mar 2012
Thanks Given: 1
Thanks Received: 0

I have a strategy trading the TF after hours, after 16:15 est, and it won't let it put in a market order. How would I code it to a limit at ask order? I'm not a programer.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
Quant vue
Trading Reviews and Vendors
How to apply profiles
Traders Hideout
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
What is Markets Chat (markets.chat) real-time trading ro …
72 thanks
Spoo-nalysis ES e-mini futures S&P 500
55 thanks
Just another trading journal: PA, Wyckoff & Trends
28 thanks
Bigger Wins or Fewer Losses?
24 thanks
The Program
16 thanks
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


Something like
 
Code
                            
EnterShortLimit(GetCurrentAsk()); 


Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #4 (permalink)
 bob998 
West Palm Beach, FL
 
Experience: Intermediate
Platform: Ninja
Trading: TF, NQ ES,CL,6E
Posts: 6 since Mar 2012
Thanks Given: 1
Thanks Received: 0

Thanks, I can't get it to compile. Here is what I have:

// Checks if the 5 period SMA is below the 50 period SMA on both the 5 and 15 minute time frames
if (SMA(BarsArray[1], 5)[0] < SMA(BarsArray[1], 50)[0] && SMA(BarsArray[2], 5)[0] < SMA(BarsArray[2], 50)[0])


if (CrossBelow(SMA(5), SMA(50), 1))
EnterShortLimit(GetCurrentAsk) ( )); (1, "SMA");
}

I have tried just EnterShortLimit (GetCurrentAsk) ()); , but this doesn't work either.
and EnterLongLimit(GetCurrentAsk)(0 ));


EnterShort(1, "SMA"); works but only as market order.

Started this thread Reply With Quote
  #5 (permalink)
 
NJAMC's Avatar
 NJAMC 
Atkinson, NH USA
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
Posts: 1,970 since Dec 2010
Thanks Given: 3,037
Thanks Received: 2,395


bob998 View Post
Thanks, I can't get it to compile. Here is what I have:

// Checks if the 5 period SMA is below the 50 period SMA on both the 5 and 15 minute time frames
if (SMA(BarsArray[1], 5)[0] < SMA(BarsArray[1], 50)[0] && SMA(BarsArray[2], 5)[0] < SMA(BarsArray[2], 50)[0])


if (CrossBelow(SMA(5), SMA(50), 1))
EnterShortLimit(GetCurrentAsk) ( )); (1, "SMA");
}

I have tried just EnterShortLimit (GetCurrentAsk) ()); , but this doesn't work either.
and EnterLongLimit(GetCurrentAsk)(0 ));


EnterShort(1, "SMA"); works but only as market order.

Here is the reference fo the command:
EnterShortLimit()

Your line here has some problem:
EnterShortLimit(GetCurrentAsk) ( )); (1, "SMA");

The proper syntax for this line should be:
EnterShortLimit(1,GetCurrentAsk( ), "SMA");

Try that...

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #6 (permalink)
 bob998 
West Palm Beach, FL
 
Experience: Intermediate
Platform: Ninja
Trading: TF, NQ ES,CL,6E
Posts: 6 since Mar 2012
Thanks Given: 1
Thanks Received: 0

That worked ,Thank you VERY MUCH!

Started this thread Reply With Quote
  #7 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


bob998 View Post
I have a strategy trading the TF after hours, after 16:15 est, and it won't let it put in a market order. How would I code it to a limit at ask order? I'm not a programer.

There may be a problem with market orders and the GTC setting, so you can also try to replace GTC with Day. This may depend on your broker.

Reply With Quote
  #8 (permalink)
 
monpere's Avatar
 monpere 
Bala, PA, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus, IB
Trading: SPY, Oil, Euro
Posts: 1,854 since Jul 2010
Thanks Given: 300
Thanks Received: 3,372


NJAMC View Post
Here is the reference fo the command:
EnterShortLimit()

Your line here has some problem:
EnterShortLimit(GetCurrentAsk) ( )); (1, "SMA");

The proper syntax for this line should be:
EnterShortLimit(1,GetCurrentAsk( ), "SMA");

Try that...

Wouldn't offset by a few ticks instead of GetCurrentAsk() have a better chance for a fill, since you are trying to simulate a market order?

Reply With Quote
  #9 (permalink)
 bob998 
West Palm Beach, FL
 
Experience: Intermediate
Platform: Ninja
Trading: TF, NQ ES,CL,6E
Posts: 6 since Mar 2012
Thanks Given: 1
Thanks Received: 0

Yes that would be great. How should I add it?

Started this thread Reply With Quote
  #10 (permalink)
 
monpere's Avatar
 monpere 
Bala, PA, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus, IB
Trading: SPY, Oil, Euro
Posts: 1,854 since Jul 2010
Thanks Given: 300
Thanks Received: 3,372



bob998 View Post
Yes that would be great. How should I add it?

A 3 tick offset from the last price would be: EnterShortLimit(1, Close[0]-(3*TickSize), "SMA");

Reply With Quote




Last Updated on April 24, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts