Onmarket dans un indicateur ?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #243095 quote
    ground77600
    Participant
    New

    Bonsoir,

    Je réfléchis à une idée d’indicateur pour afficher automatiquement des niveaux de Take Profit juste au moment d’une entrée en position et que ces niveaux soient effacés si on sort de position. En

    L’idéal serait de pouvoir utiliser l’instruction Onmarket mais ça ne marche pas quand on crée un indicateur car la structure est strictement réservée aux stratégies de trading.

    Auriez-vous une idée pour contourner ce problème ?

    Bien cordialement.

    #243096 quote
    fifi743
    Participant
    Master

    soit une variable booléen ou un algo en backtest

    #243097 quote
    ground77600
    Participant
    New

    soit une variable booléen ou un algo en backtest

    Merci pour votre réponse. Je vois bien pour l’algorithme en backtest mais pensez-vous que je pourrais m’en servir d’indicateur en trading live et manuel ? Vous parlez d’une variable en booléen mais justement que récupérer puisque je ne peux pas obtenir le nombre de positions en cours avec COUNTOFPOSITION ou ONMARKET ?

    #243098 quote
    fifi743
    Participant
    Master

    la variable c’est pour dire que vous êtes en position ou non
    mais on peut faire un BT et trader en même tempe

    #243117 quote
    Iván González
    Moderator
    Master

    Vous pouvez utiliser ce code :

    once long=0 //Boolean 0=not on market / 1= on market
    
    StartDateLong=20250117 //write here the date
    StartTimeLong=183000 //write here the time
    buyprice=230 //write here the buyprice
    takeprofit=265 //write here the takeprofit
    stoploss=210 //write here the stoploss
    
    if long=0 and opentime>=StartTimeLong and opendate>=StartDateLong then
    long=1
    idx=barindex
    endif
    
    if islastbarupdate then
    drawsegment(idx, takeprofit, barindex+10,takeprofit)coloured("green")
    drawsegment(idx, buyprice, barindex+10,buyprice)coloured("blue")
    drawsegment(idx, stoploss, barindex+10,stoploss)coloured("red")
    endif
    
    return
    #243124 quote
    ground77600
    Participant
    New

    Vous pouvez utiliser ce code :

    Bonjour Ivàn,

    Merci beaucoup ! Je vais essayer ça de suite !

    Bien cordialement.

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

Onmarket dans un indicateur ?


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by ground77600
1 year ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 01/25/2025
Status: Active
Attachments: No files
Logo Logo
Loading...