Matrix with timeframe

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #193727 quote
    LASSETASSE
    Participant
    Junior

    I need help to fix when condlong in 180minutes, then buy if condlong in 5minutes or when it does.

    If condshort the otherway around.

    DEFPARAM CUMULATEORDERS = FALSE
     
     
    TIMEFRAME(180 minutes)
     
    CondLong = 0
    CondShort = 0
     
    //PRC_Genesis Matrix | indicator
     
    // --- settings
    //TVI_Settings
    TVIr=12
    TVIs=12
    TVIu=5
     
    //CCI_Settings
    CCIPeriod=20
     
    //T3_Settings
    T3Period=8
     
    //GannHiLo_Settings
    GannHiLoPeriod=10
     
    // --- end of settings
     
     
    // Set histogram positions
    IDXTVI=0.25
    IDXCCI=0.0
    IDXT3=-0.25
    IDXGHL=-0.5
     
    //TVI (Ticks Volume Indicator)
    Mypoint=pointsize
    UpTicks=(Volume+(Close-Open)/MyPoint)/2
    DownTicks=Volume-UpTicks
    EMAUpTicks=average[TVIr,1](UpTicks)
    EMADownTicks=average[TVIr,1](DownTicks)
    DEMAUpTicks=average[TVIs,1](EMAUpTicks)
    DEMADownTicks=average[TVIs,1](EMADownTicks)
    TVIcalculate=100.0*(DEMAUpTicks-DEMADownTicks)/(DEMAUpTicks+DEMADownTicks)
    TVI=average[TVIu,1](TVIcalculate)
     
    //ProcessTVI
    //if TVI>=TVI[1] then
    //drawtext("■",barindex,IDXTVI,dialog,bold,20) coloured(0,90,255)
    //else
    //drawtext("■",barindex,IDXTVI,dialog,bold,20) coloured(255,0,0)
    //endif
     
     
     
    //CCI (Commodity Channel Index)
    dSig=CCI[CCIPeriod](typicalPrice)
     
    //ProcessCCI
    //if dSig>0 then
    //drawtext("■",barindex,IDXCCI,dialog,bold,20) coloured(0,90,255)
    //else
    //drawtext("■",barindex,IDXCCI,dialog,bold,20) coloured(255,0,0)
    //endif
     
     
     
     
    //T3
    e1 = ExponentialAverage[T3Period](close)
    e2 = ExponentialAverage[T3Period](e1)
    e3 = ExponentialAverage[T3Period](e2)
    e4 = ExponentialAverage[T3Period](e3)
    e5 = ExponentialAverage[T3Period](e4)
    e6 = ExponentialAverage[T3Period](e5)
    b = 0.618
    b2 = (b * b)
    b3 = (b * b * b)
    c1 = -b3
    c2 = (3 * b2) + (3 * b3)
    c3 = (-6 * b2) - (3 * b) - (3 * b3)
    c4 = 1 + (3 * b) + b3 + (3 * b2)
    avg = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3
     
     
    //ProcessT3
    //if avg>=avg[1] then
    //drawtext("■",barindex,IDXT3,dialog,bold,20) coloured(0,90,255)
    //else
    //drawtext("■",barindex,IDXT3,dialog,bold,20) coloured(255,0,0)
    //endif
     
     
     
     
    //GannHiLo
    if Close>average[gannhiloperiod](high)[1] then
    gann=1
    elsif Close<average[gannhiloperiod](low)[1] then
    gann=-1
    endif
     
    //ProcessGann
    //if gann>0 then
    //drawtext("■",barindex,IDXGHL,dialog,bold,20) coloured(0,90,255)
    //else
    //drawtext("■",barindex,IDXGHL,dialog,bold,20) coloured(255,0,0)
    //endif
     
    CondLong = TVI>=TVI[1] and dSig>0 and avg>=avg[1] and gann>0
    CondShort = TVI<TVI[1] and dSig<0 and avg<avg[1] and gann<0
     
    TIMEFRAME(DEFAULT)
     
     
    IF NOT LongOnMarket AND CondLong THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    IF NOT ShortOnMarket AND CondShort THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
     
    If LongOnMarket AND CondShort THEN
    SELL AT MARKET
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    IF ShortOnMarket AND CondLong THEN
    EXITSHORT AT MARKET
    BUY 1 CONTRACTS AT MARKET
    ENDIF
     
     
    SET STOP %LOSS 0
    SET TARGET %PROFIT 0
    #193756 quote
    robertogozzi
    Moderator
    Master

    What do you want to fix?

    #193765 quote
    LASSETASSE
    Participant
    Junior

    Hi robertgozzi

    I attached the wrong itf, this is the one i need help with.
    I want it to trade if ex. condlongA appears in a condlong episode

    DEFPARAM CUMULATEORDERS = FALSE
     
     
    TIMEFRAME(180 minutes)
     
    CondLong = 0
    CondShort = 0
     
    //PRC_Genesis Matrix | indicator
     
    // --- settings
    //TVI_Settings
    TVIr=12
    TVIs=12
    TVIu=5
     
    //CCI_Settings
    CCIPeriod=20
     
    //T3_Settings
    T3Period=8
     
    //GannHiLo_Settings
    GannHiLoPeriod=10
     
    // --- end of settings
     
     
    // Set histogram positions
    IDXTVI=0.25
    IDXCCI=0.0
    IDXT3=-0.25
    IDXGHL=-0.5
     
    //TVI (Ticks Volume Indicator)
    Mypoint=pointsize
    UpTicks=(Volume+(Close-Open)/MyPoint)/2
    DownTicks=Volume-UpTicks
    EMAUpTicks=average[TVIr,1](UpTicks)
    EMADownTicks=average[TVIr,1](DownTicks)
    DEMAUpTicks=average[TVIs,1](EMAUpTicks)
    DEMADownTicks=average[TVIs,1](EMADownTicks)
    TVIcalculate=100.0*(DEMAUpTicks-DEMADownTicks)/(DEMAUpTicks+DEMADownTicks)
    TVI=average[TVIu,1](TVIcalculate)
     
    //ProcessTVI
    //if TVI>=TVI[1] then
    //drawtext("■",barindex,IDXTVI,dialog,bold,20) coloured(0,90,255)
    //else
    //drawtext("■",barindex,IDXTVI,dialog,bold,20) coloured(255,0,0)
    //endif
     
     
     
    //CCI (Commodity Channel Index)
    dSig=CCI[CCIPeriod](typicalPrice)
     
    //ProcessCCI
    //if dSig>0 then
    //drawtext("■",barindex,IDXCCI,dialog,bold,20) coloured(0,90,255)
    //else
    //drawtext("■",barindex,IDXCCI,dialog,bold,20) coloured(255,0,0)
    //endif
     
     
     
     
    //T3
    e1 = ExponentialAverage[T3Period](close)
    e2 = ExponentialAverage[T3Period](e1)
    e3 = ExponentialAverage[T3Period](e2)
    e4 = ExponentialAverage[T3Period](e3)
    e5 = ExponentialAverage[T3Period](e4)
    e6 = ExponentialAverage[T3Period](e5)
    b = 0.618
    b2 = (b * b)
    b3 = (b * b * b)
    c1 = -b3
    c2 = (3 * b2) + (3 * b3)
    c3 = (-6 * b2) - (3 * b) - (3 * b3)
    c4 = 1 + (3 * b) + b3 + (3 * b2)
    avg = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3
     
     
    //ProcessT3
    //if avg>=avg[1] then
    //drawtext("■",barindex,IDXT3,dialog,bold,20) coloured(0,90,255)
    //else
    //drawtext("■",barindex,IDXT3,dialog,bold,20) coloured(255,0,0)
    //endif
     
     
     
     
    //GannHiLo
    if Close>average[gannhiloperiod](high)[1] then
    gann=1
    elsif Close<average[gannhiloperiod](low)[1] then
    gann=-1
    endif
     
    //ProcessGann
    //if gann>0 then
    //drawtext("■",barindex,IDXGHL,dialog,bold,20) coloured(0,90,255)
    //else
    //drawtext("■",barindex,IDXGHL,dialog,bold,20) coloured(255,0,0)
    //endif
     
    CondLong = TVI>=TVI[1] and dSig>0 and avg>=avg[1] and gann>0
    CondShort = TVI<TVI[1] and dSig<0 and avg<avg[1] and gann<0
     
     
     
    TIMEFRAME(5 minutes)
     
    CondLongA = 0
    CondShortA = 0
     
    //PRC_Genesis Matrix | indicator
     
    // --- settings
    //TVI_Settings
    TVIr=12
    TVIs=12
    TVIu=5
     
    //CCI_Settings
    CCIPeriod=20
     
    //T3_Settings
    T3Period=8
     
    //GannHiLo_Settings
    GannHiLoPeriod=10
     
    // --- end of settings
     
     
    // Set histogram positions
    IDXTVI=0.25
    IDXCCI=0.0
    IDXT3=-0.25
    IDXGHL=-0.5
     
    //TVI (Ticks Volume Indicator)
    Mypoint=pointsize
    UpTicks=(Volume+(Close-Open)/MyPoint)/2
    DownTicks=Volume-UpTicks
    EMAUpTicks=average[TVIr,1](UpTicks)
    EMADownTicks=average[TVIr,1](DownTicks)
    DEMAUpTicks=average[TVIs,1](EMAUpTicks)
    DEMADownTicks=average[TVIs,1](EMADownTicks)
    TVIcalculate=100.0*(DEMAUpTicks-DEMADownTicks)/(DEMAUpTicks+DEMADownTicks)
    TVI=average[TVIu,1](TVIcalculate)
     
    //ProcessTVI
    //if TVI>=TVI[1] then
    //drawtext("■",barindex,IDXTVI,dialog,bold,20) coloured(0,90,255)
    //else
    //drawtext("■",barindex,IDXTVI,dialog,bold,20) coloured(255,0,0)
    //endif
     
     
     
    //CCI (Commodity Channel Index)
    dSig=CCI[CCIPeriod](typicalPrice)
     
    //ProcessCCI
    //if dSig>0 then
    //drawtext("■",barindex,IDXCCI,dialog,bold,20) coloured(0,90,255)
    //else
    //drawtext("■",barindex,IDXCCI,dialog,bold,20) coloured(255,0,0)
    //endif
     
     
     
     
    //T3
    e1 = ExponentialAverage[T3Period](close)
    e2 = ExponentialAverage[T3Period](e1)
    e3 = ExponentialAverage[T3Period](e2)
    e4 = ExponentialAverage[T3Period](e3)
    e5 = ExponentialAverage[T3Period](e4)
    e6 = ExponentialAverage[T3Period](e5)
    b = 0.618
    b2 = (b * b)
    b3 = (b * b * b)
    c1 = -b3
    c2 = (3 * b2) + (3 * b3)
    c3 = (-6 * b2) - (3 * b) - (3 * b3)
    c4 = 1 + (3 * b) + b3 + (3 * b2)
    avg = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3
     
     
    //ProcessT3
    //if avg>=avg[1] then
    //drawtext("■",barindex,IDXT3,dialog,bold,20) coloured(0,90,255)
    //else
    //drawtext("■",barindex,IDXT3,dialog,bold,20) coloured(255,0,0)
    //endif
     
     
     
     
    //GannHiLo
    if Close>average[gannhiloperiod](high)[1] then
    gann=1
    elsif Close<average[gannhiloperiod](low)[1] then
    gann=-1
    endif
     
    //ProcessGann
    //if gann>0 then
    //drawtext("■",barindex,IDXGHL,dialog,bold,20) coloured(0,90,255)
    //else
    //drawtext("■",barindex,IDXGHL,dialog,bold,20) coloured(255,0,0)
    //endif
     
    CondLong = TVI>=TVI[1] and dSig>0 and avg>=avg[1] and gann>0
    CondShort = TVI<TVI[1] and dSig<0 and avg<avg[1] and gann<0
     
    TIMEFRAME(DEFAULT)
     
     
    IF NOT LongOnMarket AND CondLong and condlongA THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    IF NOT ShortOnMarket AND CondShort and condshortA THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
     
    If LongOnMarket AND CondShort and condshortA THEN
    SELL AT MARKET
    SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    IF ShortOnMarket AND CondLong and condlongA THEN
    EXITSHORT AT MARKET
    BUY 1 CONTRACTS AT MARKET
    ENDIF
     
     
    SET STOP %LOSS 0
    SET TARGET %PROFIT 0
    
    #194177 quote
    robertogozzi
    Moderator
    Master

    Variables TVIr, TVIs and TVIu, can only be assigned values on a single timeframe (this rule applies to any variable used), still, they can be read anywhere. So you need to use different names if you want to change their value in different timeframes.

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

Matrix with timeframe


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
LASSETASSE @lassetasse Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/23/2022
Status: Active
Attachments: No files
Logo Logo
Loading...