Params
Numeric lots(1);
Numeric RangeLimen(0);
Numeric length(30);
Vars
NumericSeries lengthday;
//NumericSeries length;
NumericSeries mta;
NumericSeries mtb;
Numeric LRSlope;
Numeric LRAngle;
Numeric LRIntercept;
Numeric LRValue;
Numeric LRSlope1;
Numeric LRAngle1;
Numeric LRIntercept1;
Numeric LRValue1;
NumericSeries MT;
Numeric SMAvalue;
NumericSeries mtOut;
Begin
lengthday=length;//NthCon(Date!=Date[1],1);
//if(Date!=Date[-1] And Date!=CurrentDate) length=lengthday;
LinearReg(Close,length,0,LRSlope, LRAngle, LRIntercept, LRValue);
mta=LRSlope;
LinearReg(mta,length,0,LRSlope1, LRAngle1, LRIntercept1, LRValue1);
mtb=LRSlope1;
mt=mtamtb50;
if(MarketPosition0 And mt[1]>RangeLimen And mta[1]>0 )
{
Buy(lots,Open);
}
if(MarketPositio