problème pour corriger un code, erreur fin du code” : ENDIF

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #216477 quote
    FXtonio
    Participant
    New

    Bonjour,

    ci dessous un algo, j’ai un problème lors du lancement ça me met (ligne 1: une des expressions suivantes serait plus appropriée que “fin du code” : ENDIF

    est ce que quelqu’un peut m’expliquer où est ce que j’ai fait une erreur?

    Merci d’avance.

    ci dessous:

    //Définition des paramètres du code
    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    
    // Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position avant l'heure spécifiée
    noEntryBeforeTime = 080000
    timeEnterBefore = time >= noEntryBeforeTime
    
    // Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position après l'heure spécifiée
    noEntryAfterTime = 180000
    timeEnterAfter = time < noEntryAfterTime
    
    // Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
    daysForbiddenEntry = OpenDayOfWeek = 5 OR OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    IF init=not onmarket THEN
    step=0
    init=1
    
    ////highs and lows
    
    if close<sarfast then
    ll=min(ll,low)
    else
    hh=max(hh,high)
    endif
    
    if close>sarfast and close[1]<sarfast[1] then //new bullish signal
    fibo0=ll
    ll=sarslow //reset ll
    if close>sarslow then
    startbar=barindex
    irange=high-fibo0
    entry = fibo0+(irange/2)
    itarget = fibo0+irange*1.618
    istop = fibo0-2*pointsize
    
    if close<sarfast and close[1]>sarfast[1] then //new bearish signal
    fibo0=hh
    hh=0 //reset hh
    if close<sarslow then
    startbar=barindex
    irange=fibo0-low
    entry = fibo0-(irange/2)
    itarget = fibo0-irange*1.618
    istop = fibo0+2*pointsize
    
    //indicateurs
    sarfast=SAR[0.02,0.02,0.2]
    sarslow=SAR[0.005,0.005,0.05]
    
    
    
    
    // Conditions pour ouvrir une position acheteuse
    
    c1=close>sarfast and close[1]<sarfast[1]
    IF c1 AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    SET TARGET PROFIT ITARGET
    SET STOP PLOSS ISTOP
    // Conditions pour ouvrir une position en vente à découvert
    
    c2=close<sarfast and close[1]>sarfast[1]
    IF c2 AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    SET TARGET PROFIT ITARGET
    SET STOP PLOSS ISTOP
    //BREAKEVEN------------------------------------------------------------------------------------------------
    
    startBreakeven0 = BE
    PointsToKeep0 = PK
    
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ENDIF
    
    // BE FOR LONG---------------------------------------------------------------------------------------------
    
    IF longonmarket and step = 0 and close - tradeprice(1) >= StartBreakeven0 * pipsize THEN
    BreakevenLevel = tradeprice(1) + PointsToKeep0 * pipsize
    step = 1
    ENDIF
    
    IF step = 1 THEN
    sell 0.5 contracts at market //(avec X le nombre de contrat a cloturer)
    step = 2
    endif
    
    IF breakevenLevel>0 THEN
    sell AT breakevenLevel STOP
    ENDIF
    #216478 quote
    JC_Bywan
    Moderator
    Master

    à vue de nez, il manque au moins 5 endif

    #216501 quote
    Nicolas
    Keymaster
    Master

    En effet, il faut revérifier dans le code où tu as récupéré les signaux, tu as fait un mauvais copier/coller 😆

    #216503 quote
    GraHal
    Participant
    Master

    Manière rapide … ajouter 5 ENDIF à la fin du code.

    Optimisez les valeurs des variables ci-dessous et cela fonctionnera, mais a besoin de plus de travail pour accepter les transactions ?

    startBreakeven0 = BE 
    PointsToKeep0 = PK
    #216612 quote
    FXtonio
    Participant
    New

    Bonjour, merci pour vos réponses, je vais corriger tout ça 🙂

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

problème pour corriger un code, erreur fin du code” : ENDIF


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
FXtonio @fxtonio Participant
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by FXtonio
2 years, 8 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 06/19/2023
Status: Active
Attachments: No files
Logo Logo
Loading...