ProRealTime: GNT@TSA-Short

Voici le code de l’indicateur ProRealTime GNT@TSA-Short

Des questions? Des idées? Des astuces? Venez échanger et discuter sur le forum !

Pour le paramétrage des variables… c’est ici.

Bons trades.

Grégoire Tardy

// Update : 08.11.2010
// Version 8
// Ajout autonomie des modules
// GNT@TSA-Short
//////////////////////////////////////////////////////////////////////////////////////////
// Variable de paramétrage //
//////////////////////////////////////////////////////////////////////////////////////////

Once FinObj = FinObj
Once FinObjSup = FinObjSup
Once FinBenef = FinBenef
Once FinType = FinType
Once Spread = Spread
Once SprType = SprType
Once Pymd = Pymd
Once Annee = Annee
Once Mois = Mois
Once Jour = Jour

If (Annee > 1950 AND Annee < 2050) AND Mois < 13 AND Jour <32 Then
 
 
 If (Year > Annee) OR (Year = Annee AND Month => Mois and Day => Jour) Then
  
  Once PosShOpenActiv = 0
  Once PosShFinActiv = 0
  Once PosShFinSupActiv = 0
  Once PosShObjActiv = 0
  Once PosShInIndic = 0
  PosShAleIndic = 0
  PosShStopIndic = 0
  PosShInvIndic = 0
  PosShFinIndic = 0
  PosShFinPlusIndic = 0
  PosShObjIndic = 0
  PosShPydIndic = 0
  PosShBenTrendIndic = 0
  PosShBenIndic = 0
  PosShOutIndic = 0
  xHIndic = 0
  Once PosShOpenPrice = 0
  Once PosShClosePrice = 0
  Once PosShBenefPrice = 0
  Once PosShStopPrice = 0
  Once PosStopPrice = 0
  Once PosShObjPrice = 0
  Once NextObjPrice = 0
  Once NextObjSupPrice = 0
  Once BenefObjPrice = 0
  Once NbTrSh = 0
  Once NbTrShSto = 0
  Once NbTrShInv = 0
  Once NbTrShFin = 0
  Once NbTrShObj = 0
  Once NbTrShWin = 0
  Once NbTrShLos = 0
  Once GainTrSh= 0
  Once TotGainTrSh = 0
  Once AvgGainTrSh = 0
  Once LosTrSh = 0
  Once TotLosTrSh = 0
  Once AvgLosTrSh = 0
  PosNbBar = 0
  Once PosBarIn = 0
  Once PosBarOut = 0
  Once CountPosBar = 0
  Once NbMoyPosBar = 0
  Once MinPosNbBar = 0
  Once MaxPosNbBar = 0
  Once StopPosNbBar = 0
  Once InvPosNbBar = 0
  Once FinPosNbBar = 0
  Once ObjPosNbBar = 0
  Once WinPosNbBar = 0
  Once LosPosNbBar = 0
  ShAle = 0
  ShSig = 0
  StopPrice = 0
  ObjPrice = 0
  ShInvSig = 0
  ShBenSig = 0
  ShOutSig = 0
  ignored, ShAle, ignored, ShSig, StopPrice, ObjPrice, ignored, ShInvSig, ignored, ShBenSig, ignored, ShOutSig = CALL “GNT@SYS
  If PosShOpenActiv = 0 Then
   If ShAle 0 Then
    PosShAleIndic = -3
   EndIf
  EndIf
  If ShSig 0 Then
   xHIndic = -3
   If PosShOpenActiv 0 Then
    xHIndic = xHIndic / 3*2
    If Pymd 0 Then
     If Pymd = 1 Then
      If PosShFinActiv 0 Then
       PosShPydIndic = -1
      EndIf
     EndIf
     If Pymd = 2 Then
      PosShPydIndic = -1
     EndIF
    EndIf
   Endif
  Else
   xHIndic =0
  EndIf
  If PosShOpenActiv 0 Then
   PosShInIndic = -1
   If PosShObjActiv 0 Then
    PosShInIndic = PosShInIndic /2
   EndIf
  Else
   PosShInIndic = 0
  Endif
  If PosShOpenActiv 0 Then
   GainTrSh = PosShOpenPrice – Close
  Else
   GainTrSh = 0
  Endif
  If FinObj 0 Then
   If PosShOpenActiv 0 Then
    If PosShFinActiv = 0 then
     If FinType = 0 Then
      NextObjPrice = PosShOpenPrice – FinObj
     Else
      NextObjPrice = PosShOpenPrice * ( 1 – ( FinObj / 100))
     Endif
     If Low <= (NextObjPrice) Then
      PosShFinIndic = -2
      PosShFinPlusIndic = 0
      PosShFinActiv = 1
      NbTrShFin = NbTrShFin + 1
      FinPosNbBar = FinPosNbBar + (BarIndex – PosBarIn)
     Else
      PosShFinIndic = 0
      PosShFinPlusIndic = 0
     Endif
    Else
     PosShFinIndic = 0
     PosShFinPlusIndic = 0
    Endif
   Endif
  EndIf
  If (FinObjSup 0 AND FinObjSup > FinObj) OR (FinObj = 0 AND FinObjSup 0) Then
   If PosShOpenActiv 0 Then
    If (PosShFinActiv 0 OR FinObj = 0) and PosShFinSupActiv = 0 Then
     If FinType = 0 Then
      NextObjSupPrice = PosShOpenPrice – FinObjSup
     Else
      NextObjSupPrice = PosShOpenPrice * ( 1 – (FinObjSup / 100))
     Endif
     If Low <= (NextObjSupPrice) Then
      PosShFinIndic = PosShFinIndic
      PosShFinPlusIndic = -2
      PosShFinSupActiv = 1
     Else
      PosShFinIndic = PosShFinIndic
      PosShFinPlusIndic = 0
      PosShFinSupActiv = 0
     Endif
    Endif
   Endif
  EndIf
  If PosShOpenActiv 0 Then
   If PosShObjActiv = 0 Then
    If Low <= PosShObjPrice Then
     PosShObjIndic = -1.5
     PosShObjActiv = 1
     NbTrShObj = NbTrShObj + 1
     ObjPosNbBar = ObjPosNbBar + (BarIndex – PosBarIn)
    Else
     PosShObjIndic = 0
    EndIf
   EndIf
   If ShBenSig = 1 Then
    PosShBenIndic = -1
   Else
    PosShBenIndic = 0
   Endif
   If FinBenef 0 AND FinBenef > MAX(FinObj, FinObjSup) Then
    If PosShFinActiv = 1 Then
     If FinType = 0 Then
      BenefObjPrice = PosShBenefPrice – FinBenef
     Else
      BenefObjPrice = PosShBenefPrice * ( 1 – (FinBenef / 100))
     Endif
     If Low <= BenefObjPrice Then
      PosShBenTrendIndic = -1.5
      If FinType = 0 Then
       PosShBenefPrice = PosShBenefPrice – FinBenef
      Else
       PosShBenefPrice = PosShBenefPrice * ( 1 – (FinBenef / 100))
      Endif
     Else
      PosShBenTrendIndic = 0
     Endif
    Endif
   EndIf
  EndIf
  If PosShOpenActiv 0 Then
   If High => PosShStopPrice OR ( ShInvSig 0 AND PosShFinActiv = 0 AND PosShFinSupActiv = 0) Or ShOutSig 0 Then
    If ShInvSig 0 AND PosShFinActiv = 0 Then
     PosShInvIndic = -1.5
     //Stat
     NbTrShInv = NbTrShInv + 1
     InvPosNbBar = InvPosNbBar + (BarIndex – PosBarIn)
     InvPosNbBar = InvPosNbBar
    EndIf
    If ShOutSig 0 Then
     PosShOutIndic = -2.5
    EndIf
    PosShClosePrice = OpenOfNextBar
    If High => PosShStopPrice Then
     PosShStopIndic = -3
     NbTrShSto = NbTrShSto + 1
     StopPosNbBar = StopPosNbBar + (BarIndex – PosBarIn)
     StopPosNbBar = StopPosNbBar
     PosShClosePrice = PosShStopPrice
     If PosShInvIndic = -2 Then
      NbTrShInv = NbTrShInv – 1
      InvPosNbBar = InvPosNbBar – (BarIndex – PosBarIn)
     EndIf
    Endif
    PosShOpenActiv = 0
    PosShFinActiv = 0
    PosShFinSupActiv = 0
    PosShObjActiv = 0
    PosBarOut = BarIndex
    NbTrSh = NbTrSh + 1
    If (PosShOpenPrice – PosShClosePrice ) > 0 Then
     NbTrShWin = NbTrShWin + 1
     WinPosNbBar = WinPosNbBar + (BarIndex – PosBarIn)
     GainTrSh = (PosShOpenPrice – PosShClosePrice)
     TotGainTrSh = TotGainTrSh + GainTrSh
     AvgGainTrSh = TotGainTrSh / NbTrShWin
     AvgGainTrSh = AvgGainTrSh
    EndIf
    If (PosShOpenPrice – PosShClosePrice) <= 0 Then
     NbTrShLos = NbTrShLos + 1
     LosPosNbBar = LosPosNbBar + (BarIndex – PosBarIn)
     LosTrSh = (PosShOpenPrice – PosShClosePrice)
     TotLosTrSh = TotLosTrSh + LosTrSh
     AvgLosTrSh = TotLosTrSh / NbTrShLos
     AvgLosTrSh = AvgLosTrSh
    EndIf
    PosNbBar = PosBarOut – PosBarIn
    CountPosBar = CountPosBar + PosNbBar
    NbMoyPosBar = CountPosBar / NbTrSh
    NbMoyPosBar = NbMoyPosBar
    If MinPosNbBar = 0 Then
     MinPosNbBar = PosNbBar
    Else
     If PosNbBar < MinPosNbBar Then
      MinPosNbBar = PosNbBar
     EndIf
    EndIf
    If MaxPosNbBar = 0 Then
     MaxPosNbBar = PosNbBar
    Else
     If PosNbBar > MaxPosNbBar Then
      MaxPosNbBar = PosNbBar
     EndIf
    EndIf
    GainTrSh = 0
   Endif
  Endif
  If (PosShStopIndic = 0 AND PosShInvIndic = 0 AND PosShInvIndic = 0) Then
   If ShSig = 1 Then
    If PosShOpenActiv = 0 Then
     PosShOpenActiv = 1
     PosShFinActiv = 0
     PosShFinSupActiv = 0
     PosShObjActiv = 0
     PosShAleIndic = 0
     PosShInIndic = 0
     PosShStopIndic = 0
     PosShInvIndic = 0
     PosShFinIndic = 0
     PosShFinPlusIndic = 0
     PosShPydIndic = 0
     PosShObjIndic = 0
     PosShBenIndic = 0
     PosShBenTrendIndic = 0
     PosShOutIndic = 0
     If SprType = 0 Then
      PosShOpenPrice = OpenOfNextBar – Spread
     Else
      PosShOpenPrice = OpenOfNextBar * (1 – (Spread / 100))
     EndIf
     PosShBenefPrice = PosShOpenPrice
     PosShStopPrice = StopPrice
     PosStopPrice = PosShStopPrice
     PosStopPrice = PosStopPrice
     PosShObjPrice = ObjPrice
     GainTrSh = 0
     LosTrSh = 0
     PosNbBar = 0
     PosBarIn = BarIndex
     PosBarOut = 0
    EndIf
   EndIf
  EndIf
 Else
  xHIndic = 0
  PosShInIndic = 0
  PosShInvIndic = 0
  PosShStopIndic = 0
  PosShFinIndic = 0
  PosShFinPlusIndic = 0
  PosShObjIndic = 0
  PosShBenTrendIndic = 0
  PosShBenIndic = 0
  PosShOutIndic = 0
  NbTrSh = 0
  NbTrShSto = 0
  NbTrShInv = 0
  NbTrShFin = 0
  NbTrShWin = 0
  NbTrShLos = 0
  NbTrShObj = 0
  TotGainTrSh = 0
  TotLosTrSh = 0
  AvgGainTrSh = 0
  AvgLosTrSh = 0
  GainTrSh = 0
  LosTrSh = 0
  PosStopPrice = 0
  FinObj = FinObj
  FinObjSup = FinObjSup
  FinBenef = FinBenef
  FinType = FinType
  Spread = Spread
  SprType = SprType
  Pymd = Pymd
  Annee = Annee
  Mois = Mois
  Jour = Jour
 Endif
EndIf

Return PosShAleIndic as “Alerte”, xHIndic as “Signal Prise Position”, PosShInIndic as “En Position Courte”, PosShInvIndic as “Signal Invalidation”, PosShStopIndic as “Signal Stop”, PosShFinIndic as “Financement Prudent”, PosShFinPlusIndic as “Financement Audacieux”, PosShObjIndic as “Signal Position Objectif” , PosShBenTrendIndic as “Position Objectif Absolu” , PosShBenIndic as “Signal Prise Bénéfice”, PosShOutIndic as “Signal Sortie”, PosShPydIndic as “Signal Pyramidage”

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>