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 Haiasi, Today, 06:53 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by ScottWalsh, Today, 06:52 PM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by ScottW, Today, 06:09 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by ftsc2022, 10-25-2022, 12:03 PM
      5 responses
      256 views
      0 likes
      Last Post KeyonMatthews  
      Started by Board game geek, 10-29-2023, 12:00 PM
      14 responses
      244 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Working...
      X