Conversion of Inverted H & S from Metastock

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #140379 quote
    scoot3r83
    Participant
    Average

    Hello,

    I have a Metastock exploration function that searches for Inverted Head & Shoulders patterns. Would it be possible to convert this to PRT code? Much like another recent exploration I requested for pennants/flags, I cannot get the zigzag function to work how I would like it to. I do not have any documentation for this code but if required I could add additional comments. I have made a few in {} below.

    Filter

    TR:=Trough(2,C,10); {Target}
    TR2:=Trough(3,C,10);
    PK1:=Peak(1,C,10); {Target}
    PK2:=Peak(2,C,10);
    PKB1:=LastValue(PeakBars(1,C,10));  {Right Shoulder}
    PKB2:=PeakBars(2,C,10);
    TRB:=TroughBars(2,C,10); {Head}
    TRB2:=TroughBars(3,C,10);  {Left Shoulder}
    TR1:=LLV(C,PKB1);  {Right Shoulder}
    TRB1:= LLVBars(C,PKB1);
    
    CONDITION1:=TRB2<260 AND TRB2>TRB+15 AND TRB>TRB1+15 AND TRB2>PKB2+8 AND PKB2>TRB+8 AND PKB1>TRB1+8
    AND TRB1>2 AND TRB1<43 AND TR1<PK1*(1-10/100);
    CONDITION2:=TR<Min(TR2,TR1)-ATR(30) AND Max(TR2,TR1)-TR<9*ATR(30) AND Abs(TR1-TR2)<2*ATR(30)
    AND Abs(PK1-PK2)<3*ATR(30);
    TGT11:=PK1-TR;TGT:=PK1+1.2*TGT11;
    CONDITION1 AND CONDITION2 AND C<tgt AND (Cross(C,PK1) OR Cross(C,TR1+3*ATR(30))) ;
    #142774 quote
    scoot3r83
    Participant
    Average

    Hi @Nicolas ,

    Just thought I would give this a bump, not sure if you had missed it or not.

    #142783 quote
    Nicolas
    Keymaster
    Master

    Trough and Peak are internal instructions of Metastock. While it is just zigzag bottom and peak, we do not have any constant in PRT to get them by offset like: peak[3] (third previous peak), so we have to make loops through the history to get them. That means that it is not easy, but i’ll try. Added to my long conversion list. Sorry but very busy actually, i’ll do my best to help here.

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

Conversion of Inverted H & S from Metastock


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
scoot3r83 @scoot3r83 Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/29/2020
Status: Active
Attachments: No files
Logo Logo
Loading...