Cookie Policy

Welcome, Guest
Username: Password: Remember me

TOPIC: Mogalef Bands code Metastock

Mogalef Bands code Metastock 24 Oct 2012 13:44 #1

  • remo
  • remo's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3077
  • Thank you received: 5560
  • Karma: 113
{ USER }
Pd1:=Input("Regression Periods",3,100,3);
Pd2:=Input("Standard Deviation Periods",3,100,7);
Pd3:=Input("Standard Deviations",1,5,2);
{ DEFINE }
AP:=(H+L+O+2*C)/5; { Price }
LR:=LinearReg(AP,Pd1); { Moving Regression line }
SD:=Stdev(LR,Pd2); { Standard Deviation }
{ LATCH }
x:=If(PREV=0, { initial or reset }
LR, { store }
If(LR>PREV+Pd3*ValueWhen(1,PREV=0,SD) { over }
OR LR<PREV-Pd3*ValueWhen(1,PREV=0,SD), { under }
0, { reset }
PREV)); { keep }
{ BANDS }
Middle:=ValueWhen(1,Ref(x,-1)=0,x); { Get LR value from point in time }
SD:=ValueWhen(1,Ref(x,-1)=0,SD); { Get SD value from point in time }
{ PLOT }
Middle+Pd3*SD; { Top - Green }
Middle-Pd3*SD; { Bottom - Red }
Middle; { Blue }
LR; { White }
Information Purposes Only, Do Your Own Research
remo
Last Edit: 24 Oct 2012 13:54 by remo.
The administrator has disabled public write access.
The following user(s) said Thank You: Libero
Moderators: remo

Time to create page: 0.291 seconds