Conversion indicateur TradingView

Forums ProRealTime forum Français Support ProBuilder Conversion indicateur TradingView

Viewing 8 posts - 1 through 8 (of 8 total)
  • #233230

    Bonjour,

    Il y a quelque temps j’avais demandé un équivalent du code tradingview mais je ne peux plus accéder à la page. Par ailleurs, le code que l’on m’a proposé ne correspond pas tout à fait (ou peut-être les modifications que j’en ai faites).

    La page de l’indicateur (mentfx Structure) : mentfx Structure

    L’explication de l’auteur du code tradingview :

    The indicator is designed to identify and track swing highs and lows in a given market on any timeframe, and display them on the chart as solid lines (the lines you see are denoting highs and lows). The lines are customizable in terms of color and width, as determined by the user input.

    The rules for creating a new high or low are based on whether the current range is considered Bullish (most recent break being to the topside) or whether the current range is considered Bearish (most recent breaking being to the downside). If the range is Bullish, the code will allow for wicks below the low without updating the low, and will only change in the case that a candle’s body (open or close) finds itself under that given low. If the range is Bearish, the code will allow for wicks above the high without updating the high, and will only change in the case that a candle’s body (open or close) finds itself above that given high.

    When a range is assigned as being bullish, it will continue updating the high until a swing high is created (denoting that as the high of the range) and will not update or change until a candle’s body, open’s or close’s above it – which will reupdate the high and update the low. The low will be updated based on the last time price had a candle (open or closure) below a previous candles low, and then will find the lowest low after the rule was met to assign a low (the idea here is to locate the last major “sell before buy” and showcase that range. And this will occur vice versa, where: when a range is assigned as bearish, it will continue updating the low until a swing low is created (denoting that as the low of the range) and will not update or change until a candle’s body, open’s or close’s below it – which will reupdate the low and update the high. The high will be updated based on the last time price had a candle (open or closure) above a previous candles high, and then will find the highest high after the rule was met to assign a high (once again, the idea being to locate the last major “buy before sell” and showcase price as existing in that range.

    A swing high is considered as a high that has a lower high to its left and to its right. And a swing low is considered as a low that has a higher low to its left and to its right. These swings are used to determine the final high or low of a Bullish or Bearish range (respectively).

    Additionally, the script includes a function that updates the lines on the chart as new market data prints (using the logic described above).

    The indicator uses a specific method (mentioned above) based on the idea of “sells before buys” (for Bullish Ranges) and “buys before sells” (for Bearish Ranges) that isnt found in other indicator. The channels shown on the screen represent prior highs and lows, as well as current updated highs and lows based on this. The reason for using this way to track Structure is that we are assuming large money is selling before purchasing heavily, and buying before selling heavily, and these ranges attempt to showcase the structural delivery of price on any timeframe in reference to this theory – theory being that if we are in a bullish range, we are likely to sustain some sort of bullish move until the next high or for a while, or from the last “sell before buy” – and vice versa. As well as being able to merge the “context” or “story” of multiple timeframes in reference to this indicator as confluence for bullish or bearish continuations. Follow’s the school of thought that comes with trend following.

    Et le code PRT qu’il me reste :

    L’image ci-dessous montre le comportement que j’obtiens en blanc et celui que j’aimerais avoir en rose.

    Exemple

    Si une bonne ame pouvait m’aider ça serait merveilleux.

    Bonne journée.

    #233282

    J’ai essayé de traduire l’explication du code TradingView en pseudo-langage informatique et j’obtiens ça :

    Haussier = Prix > BOS
    Baissier = Prix < BOS

    swingHaut = PlusHaut [2] < PlusHaut [1] and PlusHaut < PlusHaut [1]
    swingBas = Plusbas [2] > Plusbas [1] and Plusbas > Plusbas [1]

    If Range = Haussier then
    If close < plusbas then
    Maj plusbas
    BOS
    Endif

    If swingHaut = True Then
    If close > swingHaut then
    Plusbas =Lowest ( last low<Low[1])
    PlusHaut = Highest (last haut<Haut[1])
    Maj plusbas
    Maj PlusHaut
    endif
    Else
    PlusHaut= High
    Endif
    Endif

    If Range = Baissier then
    If close > plushaut then
    Maj plushaut
    BOS
    Endif
    If swingBas = True Then
    If close < swingBas then
    Plusbas =Lowest ( last low<Low[1])
    PlusHaut = Highest (last haut<Haut[1])
    Maj plusbas
    Maj PlusHaut
    Else
    PlusBas = Low
    Endif
    Endif

    #233284

    Avez-vous le code Tradingview ? Ce serait beaucoup plus facile

    #233292

    Bonjour,

    Et non, je ne l’ai pas malheureusement, il n’est pas public.

    #233540

    Hola, il a créé ce code qui vous intéressera :

    1 user thanked author for this post.
    #233567

    Merci Iván,

    je vais regarder ça.

     

    #233596

    Bonjour Iván,

    Le code ne se comporte pas comme attendu, les niveaux mis à jour lors d’une cassure de bande devraient correspondre :

    En cas de cassure à la baisse d’un range haussier : Au dernier plus haut comportant un plus haut[2] plus bas, un plus haut[1] plus haut et un plus haut[0] plus bas (en gros sur trois bougies en prenant les max, une figure tete épaule)

    Voici en blanc ce que le code devrait faire.

    Cordialement.

    #233688

    Si vous modifiez la variable prd en prd=1 alors vous obtenez des valeurs plus similaires à celles que vous indiquez. Quoi qu'il en soit, comme je l'ai dit l'autre jour. C'est une approximation (je n'ai pas le code). Salutations

    1 user thanked author for this post.
Viewing 8 posts - 1 through 8 (of 8 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login