TradingView
JoshuaMcGowan
6 Şub 2020 04:42

Strategy Test - Cancel Limit Order and Position Sizing 

Bitcoin / US Dollar Perpetual Inverse Swap ContractBitMEX

Açıklama

While working thru another project had the need to troubleshoot the canceling of a limit order syntax/process as well as work thru the code and logic to automagically set the position sizing based off two user inputs (Amount to Risk in USD and Leverage to Use) and the potential entry and stop levels for an inside bar candle pattern in this scenario. Once we find the distance between the entry and stop level we can figure out the stop percentage amount which matches up with what a user would see manually drawing using the long or short tool in tradingview. Once we have the user inputs and levels we can get an amount to be used in later qty= type of places in zeeee pine script....

Sürüm Notları

The previous code didn't meet my specific trade setup requirements but left that information commented out in case it applies and is helpful to someone else down the road. Will be testing this new approach and see how it ends up going. This is by no means a finished product but the various code snippets should be of help to others looking for ways to approach this risk management question.
Yorumlar
TacticalTraderIndia
Thanks a million! Open stop limit orders were wreaking havoc in my strategies the next day!
JoshuaMcGowan
@TacticalTraderIndia, glad it helped :)
JoshuaMcGowan
Also, the testing I was doing last night worked as I needed for my specific position sizing need so there's 3 different ways to do position sizing so hopefully it helps someone down the road.
nilux
Great stuff buddy! Thanks for sharing!
JoshuaMcGowan
@nilux, hope it helps.
Daha Fazla