SetCommission(Amount)

SetCommission procedure is used to set the commission level dinamically in the script. It has the same effect than the Commission option in System Tester's option.

 

This procedure has one parameter:
Amount   The commission for one trade. All trades have the same commission.

 

Example:

' This is a system.
Sub Main()
  SetCommission(7.99)
  SetMarginAccount(50000)
  SetTradingAccount(50000)
  For CurrentBar = BeginBar to EndBar
    I = GetValue("RSI", CurrentBar)
    I1 = GetValue("RSI", CurrentBar - 1)
    If (I < 15) and (I <> 0) and (I1 >= 15) then
      Buy(CurrentBar)
      Cover(CurrentBar + 1)
    End If
    If (I > 75) and (I1 <= 75) then
      Sell(CurrentBar)
      Short(CurrentBar + 1)
    End If
  Next
End Sub