0

Im trying to make custom qty size whenever a trade should be preformed. i was able to get to the lot size that should be traded, but it dosent open trades anymore. Spent a couple of hours on this also searched the web, no solution... would appreciate any help :)

the code works, it just doesn't work when I add the qty argument in the strategy.entry() for some reason..

Tickrisk = 0.00
stopprice = 0.00
positon = 1.00
exitprice = 0.00
if (buysignal)
    stopprice := close - low
    Tickrisk := stopprice / syminfo.mintick
    positon :=   math.round(((risk/100)/((close-low)/close)*strategy.equity)/(Tickrisk*syminfo.pointvalue))
    takeprofit= stopprice*RR+close
    exitprice := low
    strategy.entry("Long Entry"+str.tostring(positon), strategy.long , limit = Close, qty = positon )
    strategy.exit("Long Exit","Long Entry",limit = takeprofit ,stop = exitprice )

open a trade with a custom lot size

  • Check the strategy() parameters, especially `initial_capital`, `default_qty_type` and `default_qty_value`, I had similar issue because TV was unable to start a single trade because it thought I don't have enough money. – karatedog Aug 17 '23 at 09:50
  • I already have a bug with the name of the strategy.entre. try with a simple name (no spaces, only character) to see if it works – G.Lebret Aug 17 '23 at 11:37
  • @karatedog When i add qty to the entry is just doesn't count it. it tries to enter with 20 contracts while the size of the account is 1.000.000... – Gaming World Aug 17 '23 at 12:18
  • @G.Lebret it works if i dont include the qty paramater. – Gaming World Aug 17 '23 at 12:18

0 Answers0