Opening Stop Order at 1 Bar High & Position Size Calculation

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #110438 quote
    s00071609
    Participant
    Senior

    ok thanks i will check that out. In process of checking orders being executed at spots it should not. I have another question, these are the MACD codes used for Daily and 4Hour TF and I have graphed them,

    I have attached an image that shows, MACDDxxx-SIGNALDxxx as negative (which tells why the order was accepted), but shouldn’t it have been positive, ie >0. MACD line is above signal line and it is a bullish setup for daily TF.

    I am using updateonclose for both time frames. Is there something I am missing out?

    Timeframe (4 Hour, updateonclose)
    //Filters
    MACDD1 = MACD[12,26,9](close)
    SIGNALD1 = ExponentialAverage[9](MACDline[12,26,9](close))
    MACDFILTER1= MACDD1 < SIGNALD1 //DO NOt enter if MACD is bearish
    TImeframe (daily, updateonclose)
    MACDDxx = MACD[12,26,9](close)
    SIGNALDxx = ExponentialAverage[9](MACDline[12,26,9](close))
    MACDFILTER= MACDDxx < SIGNALDxx //DO NOt enter if MACD is bearish
    macd-issues.png macd-issues.png
    #110725 quote
    s00071609
    Participant
    Senior
    LL = lowest[BRL](low)
    SL = MIN(abs(BARHIGH - LL)+2*pointsize,1.8*AverageTrueRangE[14]) 
    BARHIGH = max(High [0] + pipsize*3,close + 4*pipsize) //10 x pipsize = 10 pip

    Hi,

    I am using auto calculation of stop loss level. When I graph the above values I get some weird result and I am not able to figure out why.

    When I graph

    MIN(abs(BARHIGH - LL)+2*pointsize,1.8*AverageTrueRangE[14])

    I get correct value of 14.75, but when I graph SL, i get 8.34 which makes no sense, the 1.8 ATR value is 19.7. As per the formula above, the SL value should be 14.75. I have attached an image to clarify.

    I checked to see if there is SL value elsewhere but there is no other source I can see. Where I am getting this wrong?

     

    Thanks

    StopLoss.png StopLoss.png
    #110736 quote
    robertogozzi
    Moderator
    Master

    We need:

    • full code
    • instrument used
    • TF used

    in order to replicate your trades.

    #110739 quote
    s00071609
    Participant
    Senior

    Hi Robert

    I finally figured it out, I had the graph codes at the bottom and those were under different time frame, so the values it gave and the spot where the SL calculation took place were different time frames and showed different values for variables such as ATR.

    So looks fine now although it gave such a headache. Thank you

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

Opening Stop Order at 1 Bar High & Position Size Calculation


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
s00071609 @s00071609 Participant
Summary

This topic contains 18 replies,
has 4 voices, and was last updated by s00071609
6 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/22/2019
Status: Active
Attachments: 5 files
Logo Logo
Loading...