• 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 timcjpfx, Today, 01:18 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Tyler  
    Started by lordvader34, Today, 12:48 PM
    2 responses
    12 views
    0 likes
    Last Post lordvader34  
    Started by Newtrader101, Today, 11:06 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by Newtrader101, Today, 11:03 AM
    2 responses
    9 views
    0 likes
    Last Post Newtrader101  
    Started by rickyblah12, Today, 09:57 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Working...
    X