Var: miavar(0),MioVEL0,MioVEL1,MioMOV2,MioMOV3, Miosar4, MioDM5, MioDM6;
MioVEL0 = VEL(C, 600, 0, 30);
MioVEL1 = VEL(C, 300, 0, 15);
MioMOV2 = MOV(MioVEL1, 15, 0, 0, 0);
MioMOV3 = MOV(MioVEL0, 20, 0, 0, 0);
MioSAR4 = SAR(C, 0.02, 0.2);
MioDM5 = DMIndex(C,35);
MioDM6 = DMNDX (C,35);
//installtrailingprofit(inperc,2.1,0.1);
SECTION_ENTERLONG:
if (MioVEL1 >= MioMOV2 and MioVEL0 >= MioMOV3 and MioDM5>=MioDM6)
then
EnterLong(NextBar, AtOpen);
endif;
END_SECTION
SECTION_EXITLONG:
if (MioVEL1 <= MioMOV2 and MioVEL0 <= MioMOV3 and miosar4 > C and MioDM6>=MioDM5 )
then
ExitLong(NextBar, AtOpen);
endif;
END_SECTION
SECTION_ENTERSHORT:
if (MioVEL1 <= MioMOV2 and MioVEL0 <= MioMOV3 and MioDM6>=MioDM5 ) then
EnterShort(NextBar, AtOpen);
endif;
END_SECTION
SECTION_EXITSHORT:
if (MioVEL1 >= MioMOV2 and MioVEL0 >= MioMOV3 and miosar4 < C and MioDM5>=MioDM6 ) then
ExitShort(NextBar, AtOpen);
endif;
END_SECTION