Cover(Place)

Cover procedure add a cover signal at the selected Place. Cover is only used in System Tester. To short and cover a stock, you must set a margin account size for shorting (SetMarginAccount). If not, WSA will not execute Short and Cover statements.

 

This procedure has one parameter:
Place   The day where the cover signal must be set.

 

Example:

' This is a system based on Parabolic SAR
' It only shorts stocks
Sub Main()
  For CurrentBar = BeginBar to EndBar
    SAR1 = GetValue("SAR", CurrentBar)
    SAR2 = GetValue("SAR", CurrentBar - 1)
    P1 = Close(CurrentBar)
    P2 = Close(CurrentBar - 1)

    If (P1 < SAR1) and (P2 > SAR2) then
      Short(CurrentBar)
    End If
    If (P1 > SAR1) and (P2 < SAR2 ) then
      Cover(CurrentBar)
    end If
  Next
End Sub