Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automated limit orders

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Automated limit orders

    Hello,

    I'm trying to get ninjascript to use limit orders in automation... I copied the code from the help menu, but keep getting error messages (CS1501). Here is the code I replaced
    Code:
    EnterLong(DefaultQuantity, "LMA"))
    ; with:

    Code:
                {
                    EnterLongLimit(GetCurrentBid(DefaultQuantity, "Long CMA331"));
                }
    I then tried to just use

    Code:
    EnterLongLimit(GerCurrentBid());
    and got an additional CS1502 and CS1503 error.

    I think I'm just doing it wrong. How can I get my Ninjascript strategy to use limit orders instead of market orders during automated trading?

    #2
    I'm hoping to do this strategy on sim today or tuesday... any help is much appreciated... thanks

    Comment


      #3
      GetCurrentBid(DefaultQuantity, "Long CMA331") doesn't accept 2 parameters.

      EnterLongLimit(GetCurrentBid()); -> looks like it will work

      Try: EnterLongLimit( GetCurrentBid(),"Long CMA331");

      ???



      GetCurrentBid()





      Definition

      Returns the current bid price.

      Method Return Value

      A double value representing the current bid price. Note: When accessed during a historical backtest, the close price of the evaluated bar is substituted.

      Syntax

      GetCurrentBid()
      GetCurrentBid(int barSeriesIndex)

      -----------------------------------------

      Examples

      protected override void OnBarUpdate()
      {
      if (CurrentBar < 20)
      return;

      // Only enter if at least 10 bars has passed since our last entry

      if (BarsSinceEntry() > 10 && CrossAbove(SMA(10), SMA(20), 1))
      EnterLongLimit(GetCurrentBid(), "SMA Cross Entry");
      }


      Syntax

      EnterLongLimit(double limitPrice)
      EnterLongLimit(double limitPrice, string signalName)






      Originally posted by crimsonite View Post
      Hello,
      Originally posted by crimsonite View Post


      I'm trying to get ninjascript to use limit orders in automation... I copied the code from the help menu, but keep getting error messages (CS1501). Here is the code I replaced
      Code:
      EnterLong(DefaultQuantity, "LMA"))
      ; with:


      Code:
                  {
      Code:
       [COLOR=Black]
                      EnterLongLimit(GetCurrentBid(DefaultQuantity, "Long CMA331"));
                  }[/COLOR]
      I then tried to just use

      Code:
      EnterLongLimit(GerCurrentBid());
      and got an additional CS1502 and CS1503 error.


      I think I'm just doing it wrong. How can I get my Ninjascript strategy to use limit orders instead of market orders during automated trading?

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by pechtri, 06-22-2023, 02:31 AM
      9 responses
      122 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by frankthearm, 04-18-2024, 09:08 AM
      16 responses
      66 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by habeebft, Today, 01:18 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by benmarkal, Today, 12:52 PM
      2 responses
      15 views
      0 likes
      Last Post benmarkal  
      Started by f.saeidi, Today, 01:38 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X