Reputation: 39
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
Upvotes: 0
Views: 36