Conversion of indicator Identifying Trapped Traders from TradingView

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #174557 quote
    hillsee
    Participant
    Junior

    This indicator displays how many buyers and sellers are trapped into their positions. These figures are calculated by comparing the price they entered their positions, to the current price +- trading fees.

    This indicator also features an option to account for trading fees, so that it can be used as reliably in the real world, on real people as much as possible!

    The chart is a simple zero-line cross, displaying both buyers and sellers trapped in the form of a histogram.

    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © Meesemoo
    
    //@version=4
    study("Identifying Trapped Traders")
    
    lookback = input(defval = 10, title = "How many bars lookback?", minval = 2, maxval = 500, type = input.integer)
    trading_fees = input(defval = true, title = "Account for Trading fees?", type=input.bool)
    
    fee = 0.0
    if trading_fees
        fee := (hl2 * 0.002)
    
    trapped_buyers = 0.0
    trapped_sellers = 0.0
    
    for i = 0 to lookback
        if high[i] > (hl2 - fee)
            trapped_buyers := trapped_buyers + (hl2 - high[i])
        
        if low[i] < (hl2 + fee)
            trapped_sellers := trapped_sellers + (hl2 - low[i])
            
    plot(trapped_buyers, color = color.green)
    plot(trapped_sellers, color = color.red)
    plot(0, color = color.gray)
    
    fill(plot(0), plot(trapped_buyers, color = color.green), color = color.green, transp = 70)
    fill(plot(0), plot(trapped_sellers, color = color.red), color = color.red, transp = 70)

    [attachment file=”174558″]

    tt-1.jpg tt-1.jpg
    #174560 quote
    JC_Bywan
    Moderator
    Master

    Hi,

    is there a difference with this other one earlier?

    https://www.prorealcode.com/topic/tradingview-trapped-traders-indicator-conversion/

    If not, please keep in mind the forum publication rule against double posting (you can find these rules in the yellow box below), and let us know which one of the 2 topics you prefer to be deleted, thanks.

    #174571 quote
    hillsee
    Participant
    Junior

    Thanks, I followed the link below to post the second request as I thought I’d posted the first one in the wrong place… If that makes sense. So please delete the first request. Thanks

     

    hillsee – Welcome to the forums.

    When requesting code conversions please follow the instructions found here:

    https://www.prorealcode.com/free-code-conversion/

    #174719 quote
    Nicolas
    Keymaster
    Master

    Please find below the code converted for ProRealTime:

    lookback = 10 //"How many bars lookback?"
    tradingfees = 1 //"Account for Trading fees?"
    
    fee = 0.0
    if tradingfees then 
    fee = (medianprice * 0.002)
    endif
    trappedbuyers = 0.0
    trappedsellers = 0.0
    
    hl2=medianprice
    
    for i = 0 to lookback
    if high[i] > (hl2 - fee) then 
    trappedbuyers = trappedbuyers + (hl2 - high[i])
        endif
    if low[i] < (hl2 + fee) then 
    trappedsellers = trappedsellers + (hl2 - low[i])
    endif 
    next
    return trappedbuyers coloured(0,200,0),trappedsellers coloured(255,0,0)
    
    hillsee thanked this post
    Identifying-Trapped-Traders.png Identifying-Trapped-Traders.png
    #174809 quote
    hillsee
    Participant
    Junior

    Thanks, Nicolas I’m look forward to using it.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Conversion of indicator Identifying Trapped Traders from TradingView


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
hillsee @hillsee Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by hillsee
4 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 08/02/2021
Status: Active
Attachments: 2 files
Logo Logo
Loading...