• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pair trade Profit Loss Sum

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

    Pair trade Profit Loss Sum

    Hello !!! i have litle troble to access two symbols profit loss sum
    if i enter
    if (Close[0] < Position.AvgPrice - ProfitS * TickSize)
    works fine but only one curency
    if i enter
    if (Closes[1][0] < Position.AvgPrice - ProfitS * TickSize)

    Exit at frst bar !!! dont count profit

    AvgPrice count for every curency separate or sum of prices?

    if (BarsInProgress==0)
    {
    entryOrder = EnterShort(0,Lot, "Sell");
    entryOrder = EnterShort(1,Lot, "Sell1");
    }
    if (Closes[0][0] < Position.AvgPrice - ProfitS * TickSize ||
    Closes[1][0] > Position.AvgPrice + StopS * TickSize)
    if (BarsInProgress==0 || BarsInProgress==1)
    {
    entryOrder = ExitShort(0,Lot,"Exit Short","Sell");
    entryOrder = ExitShort(1,Lot,"Exit Short1","Sell1");
    }

    #2
    Hello GainForex,

    Thank you for writing in.

    As you are utilizing multiple instruments in your strategies, you will want to use the Positions collection rather than the Position collection.

    The Positions collection holds an array of Position objects that represent positions managed by the strategy.

    More information about the Positions collection can be found in the NinjaTrader help guide at this link: https://ninjatrader.com/support/help...?positions.htm

    Utilizing Position.AvgPrice will obtain the average entry price for whatever Bars object has called OnBarUpdate(). As you would like to access the average entry price for the instrument at the index of 1, you would want to utilize Positions[1].AvgPrice.

    I would also suggest taking a look at the Multi-Time Frame & Instruments section of the help guide for further information about running a multiple instrument/multiple time frame strategy: https://ninjatrader.com/support/help...nstruments.htm

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by tshidsmre, Today, 06:06 AM
    0 responses
    3 views
    0 likes
    Last Post tshidsmre  
    Started by KetoProPlus123, Today, 06:05 AM
    0 responses
    3 views
    0 likes
    Last Post KetoProPlus123  
    Started by vdhsdkhl, Today, 03:00 AM
    0 responses
    5 views
    0 likes
    Last Post vdhsdkhl  
    Started by fluffier, Yesterday, 11:49 PM
    1 response
    18 views
    0 likes
    Last Post NinjaTrader_Marco  
    Started by GARZONJ, Yesterday, 09:02 PM
    0 responses
    10 views
    0 likes
    Last Post GARZONJ
    by GARZONJ
     
    Working...
    X