這個是利用均線判別多空力道的方法
Input:ETLong(5),ETShort(-5),RMALen(15);
Vars:RDV(0),TDV(0),NDV(0),RMA(0),DRD(0);
RMA=Average(Close,RMALen);
DRD=Close-RMA;
NDV=Summation(DRD,RMALen);
TDV=Summation(AbsValue(DRD),RMALen);
If TDV>0 then RDV=100*NDV/TDV;
If RDV>ETLong then Buy next bar at market;
If RDV<ETShort then SellShort next bar at market;
If RDV<0 then Sell next bar at market;
If RDV>0 then BuyToCovert next bar at market;