<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: karen &amp; kavan</title>
    <description>The latest articles on DEV Community by karen &amp; kavan (@mrshoja).</description>
    <link>https://dev.to/mrshoja</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1123663%2Fa8d3bd0d-a739-4b9c-beec-939d4a4ed400.jpeg</url>
      <title>DEV Community: karen &amp; kavan</title>
      <link>https://dev.to/mrshoja</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mrshoja"/>
    <language>en</language>
    <item>
      <title>How can I convert Pinescript trailing tp&amp;sl to pybit?</title>
      <dc:creator>karen &amp; kavan</dc:creator>
      <pubDate>Sun, 30 Jul 2023 09:48:34 +0000</pubDate>
      <link>https://dev.to/mrshoja/how-can-i-convert-pinescript-trailing-tpsl-to-pybit-1i3b</link>
      <guid>https://dev.to/mrshoja/how-can-i-convert-pinescript-trailing-tpsl-to-pybit-1i3b</guid>
      <description>&lt;p&gt;Hey guys,&lt;br&gt;
I tried to convert below sample code from pinescript to pybit that is about trailing stop loss and take profit but I confused&lt;br&gt;
please help me.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;trail_stop_pct = input.float(0.5, title = "trailing stop activation (%)", group = "Exit Long", inline = "LTS", tooltip = "Trailing Threshold %")
trail_offset_pct = input.float(0.5, title = "trailing offset (%)", group = "Exit Long", inline = "LTS", tooltip = "Trailing offset %")
trail_stop_tick = trail_stop_pct * close / 100
trail_offset_tick = trail_offset_pct * close / 100

sl_pct = input.float(2, title = "SL", group = "SL and TP", inline = "SLTP")
tp_pct = input.float(9, title = "TP", group = "SL and TP", inline = "SLTP")

long_sl_price = strategy.position_avg_price * (1-sl_pct/100)
long_tp_price = strategy.position_avg_price * (1+tp_pct/100)
short_sl_price = strategy.position_avg_price * (1+sl_pct/100)
short_tp_price = strategy.position_avg_price * (1-tp_pct/100)

strategy.exit("Long Exit", "Long", stop = long_sl_price, limit = long_tp_price, trail_points = trail_stop_tick, trail_offset = trail_offset_tick)
strategy.exit("Short Exit", "Short", stop = short_sl_price, limit = short_tp_price, trail_points = trail_stop_tick, trail_offset = trail_offset_tick)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>pinescript</category>
      <category>pybit</category>
      <category>trailing</category>
      <category>stoploss</category>
    </item>
  </channel>
</rss>
