Login Page - Create Account

Support Board


Date/Time: Sat, 11 May 2024 17:02:36 +0000



Post From: Converting MT4 indicator StepUp for Sierra charts

[2018-05-04 16:46:35]
User964132 - Posts: 93
I coded a more simplified stepup moving average (or block moving average) for tradestation, maybe this is easier to code for Sierra charts?
Unfortunatly I still can't code myself for Sierra charts :-( Would highly appreciate if someone could code this (using either the code in post one, or the code below)
Thanks!

Regards, NK

Easylanguage code:
{=== StepUp Moving Average OR Block Moving Average =============}

  Inputs: SU_ATR_Length ( 2000 ),
     SU_ATR_BoxMultiplyer_1 ( 8 ),
     SU_ATR_BoxMultiplyer_2 ( 13 );

  Vars:   SU_DIR1(0),  SU_WorkBoxHalf1(0),  SU_Midl1(0),  SU_Bot1(0),   SU_Top1(0),
     SU_DIR2(0),  SU_WorkBoxHalf2(0), SU_Midl2(0),  SU_Bot2(0),   SU_Top2(0) ;

  
  SU_WorkBoxHalf1 = ( SU_ATR_BoxMultiplyer_1 * AvgTrueRange( SU_ATR_Length ) * 0.5 ) ;
  
  If H > SU_Top1 then begin
     SU_DIR1 = 1 ;
     SU_Top1 = H ;
     SU_Midl1 = SU_Top1 - SU_WorkBoxHalf1 ;
     SU_Bot1 = SU_Top1 - ( 2 * SU_WorkBoxHalf1 ) ;
   End else
   If L < SU_Bot1 then begin
     SU_DIR1 = -1 ;  
     SU_Bot1 = L ;
     SU_Midl1 = SU_Bot1 + SU_WorkBoxHalf1 ;
     SU_Top1 = SU_Bot1 + ( 2 * SU_WorkBoxHalf1 ) ;
   end ;

  
  SU_WorkBoxHalf2 = ( SU_ATR_BoxMultiplyer_2 * AvgTrueRange( SU_ATR_Length ) * 0.5 ) ;
  
  If H > SU_Top2 then begin
     SU_DIR2 = 1 ;
     SU_Top2 = H ;
     SU_Midl2 = SU_Top2 - SU_WorkBoxHalf2 ;
     SU_Bot2 = SU_Top2 - ( 2 * SU_WorkBoxHalf2 ) ;
   End else
   If L < SU_Bot2 then begin
     SU_DIR2 = -1 ;  
     SU_Bot2 = L ;
     SU_Midl2 = SU_Bot2 + SU_WorkBoxHalf2 ;
     SU_Top2 = SU_Bot2 + ( 2 * SU_WorkBoxHalf2 ) ;
   end ;

  
  
    { ================ Print ======================================}

    vars: SU_mid_C1(0), SU_mid_C2(0);

    If SU_DIR1 = 1 then SU_mid_C1 = cyan else SU_mid_C1 = magenta ;

     plot1 ( SU_Midl1, " SU_Midl1 " , SU_mid_C1 ) ;
    
    If SU_DIR2 = 1 then SU_mid_C2 = cyan else SU_mid_C2 = magenta ;

     plot2 ( SU_Midl2, " SU_Midl2 ", SU_mid_C2 ) ;

imageTMA with double bands on Oil.PNG / V - Attached On 2018-05-04 16:45:54 UTC - Size: 159.01 KB - 599 views