LongTriggered

Category: ProBacktest

LongTriggered is a function in ProBuilder language that is used to determine if a long position has been opened on a specific candlestick. This function is particularly useful for identifying if an order has been executed and whether its associated stop loss or take profit has been triggered within the same candlestick. This is especially relevant in scenarios involving pending orders, also known as Working Orders (WO).

Syntax:

LongTriggered[N]

Where N is an optional parameter that specifies the candlestick index relative to the current candlestick. If N is not provided, it defaults to 0, indicating the current candlestick.

Example:

if LongTriggered then
    buycount=buycount+1
endif

This example checks if a long position was opened on the previous candlestick (N=1). If true, the buycount variable is increased by 1.

Additional Information:

  • The LongTriggered function is essential for traders using automated strategies who need to track the execution and outcome of their orders within the same candlestick.
  • Understanding the index N is crucial as it allows the programmer to check the status of a trade at various points in the past relative to the current candlestick.

Using LongTriggered effectively can help in managing trades more precisely by providing immediate feedback on order execution and its consequences within a trading strategy.

Related Instructions:

  • ShortTriggered probacktest
  • Logo Logo
    Loading...