Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/13/2005(UTC) Posts: 715 Location: Midwest, USA
Was thanked: 1 time(s) in 1 post(s)
|
Well, we're all newbies sometime -- it helps to fiddle with existing code...
Here's what you described: --------------------------- MAshort:=Mov(C,50,S); MAlong:=Mov(C,100,S); Slope:=MAshort>Ref(MAshort,-1);
Sum(C>MAlong,50)>=50 AND Sum(Slope,100)>=30;
Not sure why you wanted a postive slope of 30 out of 100; you might experiment by changing that last line to "AND Sum(Slope,30)>=30;"
Also, you can use INPUT variables to change the parameters, without modifying the code. The above would look like this:
MA1:=Input("Short MA",1,500,50); MA2:=Input("Long MA",1,500,100); Length1:=Input("Close over MA",1,500,50); SlopePositive:=Input("Slope Positive",1,500,30); SlopePeriod:=Input("Slope Period",1,500,100);
MAshort:=Mov(C,MA1,S); MAlong:=Mov(C,MA2,S); Slope:=MAshort>Ref(MAshort,-1);
Sum(C>MAlong,Length1)>=Length1 AND Sum(Slope,SlopePeriod)>=SlopePositive;
Note that there is a limit of six (6) INPUT variables and a limit of 20 variables total in an indicator.
If you are going to "scan" in an Exploration, INPUT cannot be used, BUT you can "call" the indicator using FML and/or FMLVAR -- just set the "default" parameter to what you want to use in the Exploration.
Put the FML code in the FILTER tab; if you want to see the indicator value, put the exact same code in one of the Exploration COLUMNS.
Have fun.
|