Equilla Formula Language


Returns the number of bars that have elapsed since the specified position was exited.


Numeric: (Optional) The position to examine. Omit this parameter or use zero (0) to indicate the current position.


For the current position the function always returns 0.

The Position parameter specifies the number of the referenced position relative to the current one. A value of zero (0) identifies the current position, a value of one (1) the previous one.


Wait a number of bars before entering a new position
Input: Price( Close ), Period( 10, 1 ), MaxBarsPerPosition( 5, 1 ), BarsToWait( 5, 0 ); If TotalPositions() = 0 Or BarsSinceExit( 1 ) >; BarsToWait Then Begin If Average( Price, Period ) Crosses Price Then Buy Next Bar at Market Else If Price Crosses Average( Price, Period ) Then Short Next Bar at Market; End; If MarketPosition <;>; MarketPositionFlat Then Begin If BarsSinceEntry() >; MaxBarsPerPosition Then ExitPosition Next Bar At Market; End;