Signal on 1h, trade on 5 min

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #122502 quote
    Dr ManhattanDr Manhattan
    Participant
    Senior

    I want to get a signal on the 1 hour timeframe using the timeframe(1 hour) then I would like to take the trade on the 5 min timeframe(5 minute). I notice I can get the signal many times from the hourly time frame so I would only like to take 1 trade / hour. Also I either get stopped out or take profit especially if stopped out would not like to try again this hour. How can I code this? any tips

    #122507 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    In the 1h TF add:

    MyBar = Barindex

    Then add this to your 5min TF:

    Once TradeON = 1
    If OnMarket Then
       TradeON = 0
    endif
    If not OnMarket and MyBar <> MyBar[1] Then
       TradeON = 1
    Endif
    Dr Manhattan thanked this post
    #122508 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    I edited the above code.

    Also add

    And TradeON = 1

    to your entry conditions.

    Dr Manhattan thanked this post
    #122511 quote
    Dr ManhattanDr Manhattan
    Participant
    Senior

    Thanks man!

    #122583 quote
    Dr ManhattanDr Manhattan
    Participant
    Senior

    Hey Roberto, I have a  new challenge for you. I wanna try to trade 2 times per hour just to se how I fair with a few more trades. The reason could be I could use a tigheter stop to take the first wave down and the get out on the pullback and then back in. Ofc I could also use a larger stop but I still like to minimize any damage when Im going the wrong way. Do you know how?

    #122598 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    You need to add a variable to count trades.

    DEFPARAM CumulateOrders = false
    TIMEFRAME(1 hour,UpdateOnClose)
    Sma10 = close > average[10,0](close)          //variable updated every hour
    Bar1h = BarIndex                              //variable updated every hour
    TIMEFRAME(default)
    ONCE Count = 0
    IF Bar1h <> Bar1h[1] THEN                     //at each hour change clear Count
       Count = 0
    ENDIF
    IF Sma10 AND Count < 2 AND Not OnMarket THEN
       BUY 1 CONTRACT AT MARKET
       Count = Count + 1                          //Tally trades opened
    ENDIF
    SET TARGET pPROFIT 15
    SET STOP   pLOSS   15
    Dr Manhattan thanked this post
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Signal on 1h, trade on 5 min


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
6 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/18/2020
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...