Créer un screener basé sur volume-supertrand-ai

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #229219 quote
    francis59francis59
    Participant
    Junior

    Bonjour,

    Serait-il possible de créer un screener pour détecter les meilleurs moments d’ACHAT et de VENTE basé sur : https://www.prorealcode.com/prorealtime-indicators/volume-supertrend-ai/ ?

    Si à tout hasard ce n’est pas pertinent, dites-le moi et ne perdez pas votre temps 🙂

    Par avance merci et bonne journée

    #229266 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Vous pouvez passer par le bus suivant :

    //PRC_Volume SuperTrend AI
    //version = 0
    //29.02.24
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    ///////////////////////////////////////////////////////////////////////
    //inputs
    // ~~ Input settings for K and N values
    k = 3 // Neighbors 1 to 100
    //m = 10 // Data
    //n = max(k,m)
    //// ~~ Input settings for prediction values
    //KNNPriceLen = 20 // Price Trend 2 - 500 step 10
    //KNNSTlen = 100 // Prediction Trend 2 - 500 step 10
    aisignals = 1 // Boolean AI Trend Signals
    //// ~~ Define SuperTrend parameters
    len = 10 // Length
    factor = 3.0 // step 0.1
    maSrc = 0 // MaType
    // ~~ Calculate the SuperTrend based on the user's choice
    vwma = average[len,maSrc](close*volume)/average[len,maSrc](volume)
    atr = averagetruerange[len](close)
    
    upperband = vwma + factor*atr
    //lowerband = vwma - factor*atr
    
    if barindex < len then
    upperband = close
    lowerband = close
    direction = 1
    else
    //Redefine upperband
    if upperband < upperband[1] or close[1] > upperband[1] then
    upperband = upperband
    else
    upperband = upperband[1]
    endif
    //Redefine lowerband
    if lowerband > lowerband[1] or close[1] < lowerband[1] then
    lowerband = lowerband
    else
    lowerband = lowerband[1]
    endif
    //Define upperband
    prevSupertrend = mysuperTrend[1]
    if prevSupertrend = upperband[1] then
    if close > upperband then
    direction = -1
    else
    direction = 1
    endif
    else
    if close < lowerband then
    direction = 1
    else
    direction = -1
    endif
    endif
    endif
    
    if direction = -1 then
    mysupertrend = lowerband
    else
    mysupertrend = upperband
    endif
    //// ~~ Collect data points and their corresponding labels
    //myprice = WeightedAverage[KNNPriceLen](close)
    //sT = WeightedAverage[kNNSTlen](mysupertrend)
    //
    //for i=0 to n-1 do
    //$data[i]=mysupertrend[i]
    //if myprice[i] > sT[i] then
    //$labels[i] = 1
    //else
    //$labels[i] = 0
    //endif
    //next
    //
    //// ~~ Classify the current data point
    //currentsuperTrend = mysuperTrend
    ////label = knn_weighted(data, labels, k, current_superTrend)
    //
    //// Compute distances from the current point to all other points
    //n1 = lastset($data)
    //for i = 0 to n1-1 do
    //$distances[i] = abs(currentsuperTrend[i]-$data[i])
    //$indices[i] = i
    //next
    //// Sort distances and corresponding indices in ascending order
    //// Bubble sort method
    //for i=0 to n1-2 do
    //for j=0 to n1-i-2 do
    //if $distances[j]>$distances[j+1] then
    //tempDist = $distances[j]
    //$distances[j]=$distances[j+1]
    //$distances[j+1]=tempDist
    //tempindex = $indices[j]
    //$indices[j]=$indices[j+1]
    //$indices[j+1]=tempindex
    //endif
    //next
    //next
    //// Compute weighted sum of labels of the k nearest neighbors
    weightedsum=0
    totalweight=0
    for i=0 to k-1 do
    //myindex = $indices[i]
    labeli = $labels[i]
    weighti = 1 / ($distances[i]+pow(10,-6) )
    weightedsum = weighti*labeli+weightedsum
    totalweight = weighti+totalweight
    next
    //
    label = floor(weightedsum / totalweight,2)
    //
    //// ~~ Ai Super Trend Signals
    starttrendup = label = 1 and label[1]<>1 and aisignals
    starttrenddn = label = 0 and label[1]<>0 and aisignals
    TrendUp = direction = -1 and direction[1] = 1 and label = 1 and aisignals
    TrendDn = direction = 1 and direction[1] = -1 and label = 0 and aisignals
    //
    
    screener [starttrendup or starttrenddn or TrendUp or TrendDn]
    

    Te aviso que saldrán pocos valeurs

    francis59 thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Créer un screener basé sur volume-supertrand-ai


ProScreener : Scanners de Marché & Détection

New Reply
Author
author-avatar
francis59 @francis51 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Iván GonzálezIván González
2 years, 6 months ago.

Topic Details
Forum: ProScreener : Scanners de Marché & Détection
Language: French
Started: 03/05/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...