How to enter and exit the market at each big pic ?

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #161865 quote
    macdopa
    Participant
    Average

    How to enter and exit the market at each pic ?
    While you are in a bar or candlestick (in 60 seconds) – when it has a big pic ( alpha=up or omega=down) of a certain value(X=10 to 100 PIP) of the exchange rate – how can you program the buy (if pic goes up) or sell (if pic goes down) and exit directly after (in the same bar or in 1 minute)?
    See Image with the blue circles on the pics.
    Thanks !

    EA_PIC.jpg EA_PIC.jpg
    #161887 quote
    Nicolas
    Keymaster
    Master

    Topic moved in the English section of the forum (you posted in the french one).

    I think you are talking about the tail and nose of the candlestick (not pic).

    The size of the tail and nose can’t be known before the candle is closed, so what you want is detect the difference between the high – max(open,close) and the min(open,close) – low, during the life of the bar, is that right?

    tail-wick-nose-candlestick.png tail-wick-nose-candlestick.png
    #161893 quote
    macdopa
    Participant
    Average

    so what you want is detect the difference between the high – max(open,close) and the min(open,close) – low, during the life of the bar, is that right?
    YES thanks to give or show me code.

    #161915 quote
    Nicolas
    Keymaster
    Master

    the code is:

    timeframe(5 minutes) //timeframe of the bar, use whatever the one you want 
    upper = high – max(open,close)
    lower = min(open,close) – low
    
    timeframe(default) 
    //add below what you want to do with that values
    // example: if upper>10*pointsize then ... endif
    #161945 quote
    macdopa
    Participant
    Average

    Thanks for the code, well it doesn’t work according to the logic of the strategy.
    Here’s how it works already. And we want your help to perfect it as desired (see my question).

     

    //----------------------------------------
    ONCE Pic = 50 // variation : 10 to 100
    indexBar = 0
    
    WHILE IntradayBarIndex > indexBar DO
        upper = ABS(Open - High)
        lower = ABS(Open - Low)
    
        IF upper >= Pic AND ....... THEN
        .....BUY........
        ELSIF lower >= Pic AND ....... THEN
        .....SELL........
        ............
        ENDIF
        
        indexBar = indexBar + 1
    WEND
    

    Thanks for yours suggestions.

    #161952 quote
    Vonasi
    Moderator
    Master

    macdopa – Please be more careful when posting any future posts. Your post was a HTML mess that needed tidying up by moderators as you had your comments within the inserted PRT code box.

    You have 5 minutes after submitting any post to delete or edit it if it does not look right.

    #161971 quote
    Nicolas
    Keymaster
    Master

    I think that your logic is wrong.

    1/ you are using a loop to scan all candles of the day, even ones far from the current period, why? How would it be possible to trade in the past? 😀

    2/ I might be wrong, but you are computing the wrong way the tail/nose size, you are using open of the candle for both sides of the candlesticks, the definition I used is the right way to get the sizes of the tail/nose, no matter if close>open or close<open.

    Please have a second look to the code I gave above, it uses the 5 minutes bar to get the wick/nose size. This calculation is made 1 time each “default” timeframe, which can be the 1-minute one for instance.

    So basically, during the 10:05:00 candlestick, if at 10:03:00 the tail is > 10 points, an order is launched (we act during the candlestick formation). But, you should now that if at the closure of the 10:05:00 candlestick the tail isn’t > 10 points, it doesn’t mean it never been during the life of the candle! And that’s what you see on an history chart that only show you closed bars.

    #161985 quote
    macdopa
    Participant
    Average

    My logic is good and it works, but I still need to make it better: It consists in taking advantage in each bar (candlestick) in the timeframe of 1 minute (60 seconds) which presents great Ticks.

    1/ you use a loop to scan all the candles of the day, even those that are far from the current period, why? How would it be possible to exchange in the past? 😀
    ANSWER: The loop runs in each candle and so on when a big gap between Ask and Bid is found. After that, we move on to the next candle (in progress) .

    2/ I could be wrong, but you calculate the candle tail/nose size in the wrong way, you use the candle opening for both sides of the candlesticks, the definition I used is the right way to get the tail/nose sizes, it doesn’t matter if close>open or close<open.
    ANSWER: It already works with my formula. In yours, the price-close is the problem; because, when you’re still in the bar, the closing price is not yet known. Now, according to my logic, the take-profit set must be realized before the end (close) of the candle (according to the timeframe).

    I think that, now, with your expertise, you will improve the code well in order to take advantage of the bounce of the big Tick to launch the corresponding order (in the opposite direction of the variation of the Tick) and exit directly after Take-profit.
    NB: The Take-Profit varies from 20 to 100 PIP for Forex and from 100 to 300 PIP for Crypto-money.

    #161986 quote
    Nicolas
    Keymaster
    Master

    1/ that point is not clear to me sorry, I dont understand why you are looping through the previous bars? Are you looking in “big gap” from the previous bars in order to trade in the current one?

    2/ Close price is the current price, during a candlestick, that’s why I’m using it in the code 🙂

    #161990 quote
    macdopa
    Participant
    Average

    1/ that point is not clear to me sorry, I dont understand why you are looping through the previous bars? Are you looking in “big gap” from the previous bars in order to trade in the current one?
    (=NO. In the current bar, with the WHILE control, if you spot a big gap, then you launch the corresponding order and exit as soon as the profit is reached).

    2/ The closing price is the current price, during a candlestick, that’s why I use it in the code 🙂.
    (OK for the price-Close)

    #162006 quote
    Nicolas
    Keymaster
    Master

    1/ your loop is not necessary here, i’m sorry.

    Code is read only just one time during a bar, so in order to do something during the bar, we have to use an inferior timeframe.

    Here is the strategy code that is read 300 times during a 5-minutes bar by launching it on a 1-sec timeframe:

    defparam cumulateorders=false
    
    timeframe(5 minutes) //timeframe of the bar, use whatever the one you want
    upper = high - max(open,close)
    lower = min(open,close) - low
    green = close>open
    red = close<open
    
    timeframe(default)
    size = 5 //size of nose/wick
    if not onmarket then 
     if upper>size*pointsize and green then 
      buy 1 contract at market 
     endif 
    
     if lower>size*pointsize and red then 
      sellshort 1 contract at market 
     endif 
    endif 
    
    set target pprofit 20
    set stop ploss 10
    
    graph upper coloured(0,200,200)
    graph lower coloured(200,200,0)
    graph size

     

    Look at attached picture in order to understand how it works, please.

    nose-wick-strategy-intrabar.png nose-wick-strategy-intrabar.png
    #162029 quote
    macdopa
    Participant
    Average

    It doesn’t work.
    I tested with USD/CHF and BTC/USD; no results.

    #162042 quote
    GraHal
    Participant
    Master

    Works on DJI … see attached, spread = 5

    Tail.jpg Tail.jpg
    #162044 quote
    macdopa
    Participant
    Average

    GraHal, give-me a link…

    #162045 quote
    GraHal
    Participant
    Master

    Better still … attached!

    Tail-2.jpg Tail-2.jpg
Viewing 15 posts - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.

How to enter and exit the market at each big pic ?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
macdopa @macdopa Participant
Summary

This topic contains 18 replies,
has 4 voices, and was last updated by Vonasi
5 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/18/2021
Status: Active
Attachments: 9 files
Logo Logo
Loading...