0

Here's my simplified strategy code (wrapped for better readability):

strategy("Strategy Test", 
  overlay=true, 
  margin_long=0.2, // 500x leverage, if I'm right. 
  margin_short=0.2,
  initial_capital = 1000, 
  default_qty_type = strategy.percent_of_equity, 
  default_qty_value = 50)


if shortCondition
    strategy.entry("short", strategy.short)        

The problem is, no matter how I modify those Leverage ratio parameters, the result of the backtesting is all the same.

How to make that leverage parameters applied to the positions the Strategy makes?

Vendrel
  • 865
  • 9
  • 19

1 Answers1

0

Figured it out. No ignoring.

The proper code is below.

Assume we want to use 5% of our Equity for a Position, and we trade with 500x leverage because we trade on Forex.

strategy("5% Equity / 500x Leverage Trading", 
  overlay=true, 
  margin_long=0.2, // 0.2% margin level = 500x leverage 
  margin_short=0.2, // --II--
  initial_capital = 100, 
  default_qty_type = strategy.percent_of_equity, 
  default_qty_value = 5 / (0.2 / 100) ) // Eq% / (margin_ / 100)


if shortCondition
    strategy.entry("short", strategy.short) // No QTY specified!
Vendrel
  • 865
  • 9
  • 19