Multi timeframe – MTF indicators for ProRealTime

Forums ProRealTime English forum ProBuilder support Multi timeframe – MTF indicators for ProRealTime

Viewing 8 posts - 136 through 143 (of 143 total)
  • #234924

    Thanks, by launching the strategy on the 1 minute TMF, do you mean placing the  1mn lines at the beginning of the global code and then the 60 minutes conditions / lines of code ? Thanks

     

    #234929

    Place your code related to the 60-minutes timeframe under this statement:

    and the rest, about the 1-minute conditions below this:

    Default is the current timeframe of the chart.

    #234950

    HI, dos not work . My code (not even finished at that stage)  is looking like . The idea is to check few indicators during a 1 hour timeframe ad if one of the indicator is correctly responding, then to generate immedately an order during the 1 minute timeframe… It means i need to get the expected signal during the 60 minutes timeframe and immediately react under the 1 mn timeframe. It also means i cannot wait the 1 hour TF is closed and restart  ….thats probably the issue. I also tested the condition all conditions = order or 1 of the conditions )= order. without success.

    DEFPARAM CumulateOrders = False // Cumul des positions désactivé

    // Prevents the system from placing new orders on specified days of the week

    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0

    // 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 = 003000

    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 = 215500

    timeEnterAfter = time < noEntryAfterTime

    // Conditions pour ouvrir une position acheteuse

    timeframe (60 minutes)

    indicator1 = xxxx[x]

    c1 = (indicator1 > x)

    indicator2 = xxxxxx[x]

    indicator3 = xxxxx[x](open)

    c2 = (indicator2 CROSSES OVER indicator3)

    indicator4 = xxxxx[x](totalPrice)

    indicator5 = xxxxxxx[x](totalPrice)

    c3 = (indicator4 CROSSES OVER indicator5)

    indicator6 = xxxxxx[x](totalPrice)

    indicator7 = xxxxx[x](totalPrice)

    c4 = (indicator6 CROSSES OVER indicator7)

    indicator8 = xxxxxxxxx[x,y](close)

    indicator9 = xxxxxxx[x](xxxxxxxxxx[x,y](close))

    c5 = (indicator8 CROSSES OVER indicator9)

    indicator10 = xxxxxxxx[x](xxxxxxxxxxxxxxxx[x,y](close))

    c6 = (indicator10[1] CROSSES OVER indicator10)

    c7 = (indicator2[1] CROSSES OVER indicator3)

    timeframe(1 minute,default)

    IF (c1 AND c2 AND c3 AND c4 AND c5 AND c6 And 7) AND not daysForbiddenEntry THEN

    BUY 1 SHARES AT MARKET

    ENDIF

     

     

     

    #234956

    Hmmm

    Lolzzzz

    Anyway, your want an indicator on the 1hr timeframe to trigger a buy or sell on the 1 minute timeframe…

    It wont happen, becuase you may have to wait a minute for the close of the 1 minute… so here’s an example code, but for an immediate reaction run on the 1 second timeframe not 1 minute…Let me give you a code for running a code on 1 second chart only using the values or results from 5 or 10 minutes chart.
    So once you have the variable triggered in the HTF the in the below case it retains the value of the close, otherwise it updates all the time and messes up the trail… so

    timeframe (1hour, updateonclose)
    If not onmarket then
    mytrigger=0
    endif
    if movingaverageA crossesovermoving averageB then
    Mytrigger=1
    else
    mytrigger=0
    endif
    timeframe (1 second)
    If not onmarket and mytrigger=1 then
    sell myamount contracts at market
    endif

    // If you use the 1 minute chart, you may have to await the end of bar, so for immediate execution use the 1 second timeframe for execution of trades and HTFs for conditions determination

     

    Timeframe (10 minute, updateonclose) //this will ensure only the close value is taken and it doesnt constantly update on the deafault timeframe//
    Timeframe (10 minute, updateonclose)
    if close[0] then
    close10min=close[0]
    endif

    Timeframe (5 minute, updateonclose)
    if close[0] then
    close5min=close[0]
    endif

    timeframe (default)//you can put this as 5 minutes, or whatever but the code runs on the 1 second chart and runs the dax trail perfectly well
    if daxtrail5mins=1 then
    once m=0
    IF Not OnMarket THEN
    trailpausecount=0
    TrailStart = 8 //10 Start trailing profits from this point
    BasePerCent = 0.100 //10.0% Profit to keep
    StepSize = 3 //6 Pips chunks to increase Percentage
    PerCentInc = 0.100 //10.0% PerCent increment after each StepSize chunk
    RoundTO = -0.5 //-0.5 rounds to Lower integer, +0.4 rounds to Higher integer
    PriceDistance = 7 * pipsize//8.9 minimun distance from current price
    y1 = 0
    y2 = 0
    ProfitPerCent = BasePerCent
    endif
    If onmarket and m=0 then
    m=1
    ENDIF
    If not onmarket and m=1 THEN
    QUIT
    endif
    If trailtimeframe=5 then
    close5=close5min
    elsif trailtimeframe=10 THEN
    close5=close10min
    endif
    If onmarket and close5 then
    IF LongOnMarket AND close5 > (TradePrice + (y1 * pipsize)) THEN //LONG
    x1 = (close5 – tradeprice) / pipsize //convert price to pips
    IF x1 >= TrailStart THEN //go ahead only if N+ pips
    Diff1 = abs(TrailStart – x1)
    Chunks1 = max(0,round((Diff1 / StepSize) + RoundTO))
    ProfitPerCent = BasePerCent + (BasePerCent * (Chunks1 * PerCentInc))
    ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))
    y1 = max(x1 * ProfitPerCent, y1) //y = % of max profit
    ENDIF
    ELSIF ShortOnMarket AND close5 < (TradePrice - (y2 * pipsize)) THEN//SHORT x2 = (tradeprice - close5) / pipsize //convert price to pips IF x2 >= TrailStart THEN //go ahead only if N+ pips
    Diff2 = abs(TrailStart – x2)
    Chunks2 = max(0,round((Diff2 / StepSize) + RoundTO))
    ProfitPerCent = BasePerCent + (BasePerCent * (Chunks2 * PerCentInc))
    ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))
    y2 = max(x2 * ProfitPerCent, y2) //y = % of max profit
    ENDIF
    ENDIF
    IF y1 THEN //Place pending STOP order when y>0
    SellPrice = Tradeprice + (y1 * pipsize) //convert pips to price
    IF abs(close5 – SellPrice) > PriceDistance THEN
    IF close5 >= SellPrice THEN
    SELL AT SellPrice STOP
    ELSE
    SELL AT SellPrice LIMIT
    ENDIF
    ELSE
    SELL AT Market
    ENDIF
    If not onmarket and m=1 THEN
    QUIT
    endif
    ENDIF
    IF y2 THEN //Place pending STOP order when y>0
    ExitPrice = Tradeprice – (y2 * pipsize) //convert pips to price
    IF abs(close5 – ExitPrice) > PriceDistance THEN
    IF close5 <= ExitPrice THEN EXITSHORT AT ExitPrice STOP ELSE EXITSHORT AT ExitPrice LIMIT ENDIF ELSE EXITSHORT AT Market ENDIF If not onmarket and m=1 THEN quit endif ENDIF endif endif

    #234957

    U know I didnt have insrt PRT code in my before window, so sorry abo that, thought something had changed, but now its there again…. Hmmm

     

    Heres the codes again

     

    #236623

    I would like to make an indicator with different timeframes. To give an example: If I wanted to observe if the RSI is oversold in a time frame of 1 second, let me know with a signal in a time frame of 5 minutes, which is where I usually work. My goal is to be able to save time and not have to change time frames.
    This you think can be achieved. I’ve been thinking about it for a while but I can’t do it.

    Thank you.

    #236629

    The support for multiple time frames implies that on a 1-second TF you can check conditions on a 5-minute TF, not the other way round.

    The TF on your chart must always be the smallest one. Of course you can have both the 1-second and 5-minute TF on your chart, but the indicator needs to be added to the 1-second TF.

     

    1 user thanked author for this post.
    #236665

    Thank you Roberto for your response.

Viewing 8 posts - 136 through 143 (of 143 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login