Posted By: MINER
WHY DOES THIS HAPPEN WHILE LIVE TRADING - 11/23/18 11:16
Hello Everyone, I have a simple script on simple moving averages, the averages in the script are the same shown in the attached mt4 chart, but i cant figure out why zorro is repeatedly trading whenever there are some supports/resistance and the script is just on crossovers/unders. the additional arrow shows the bar when zorro placed a buy trade.....how can i avoid this behavior. Your help is highly appreciated guys.
Posted By: jcl
Re: WHY DOES THIS HAPPEN WHILE LIVE TRADING - 11/23/18 11:45
It's a bit difficult to tell you what's wrong with your script without seeing it, but one request: Please switch off the CAPS key when typing titles. Thank you.
Posted By: MINER
Re: WHY DOES THIS HAPPEN WHILE LIVE TRADING - 11/23/18 12:34
Well noted jcl,
Below is the code, Kindly Help.
........
function run()
{
StartDate = 2005;
BarPeriod = 60;
Lots = 30;
MaxLong = 1;
MaxShort = 1;
Stop = 2 * ATR(14);
Trail = 2 * ATR(14);
//EntryTime =
Entry = -5*PIP;
Algo = "SMA 15,5"
vars Close = series(priceClose());
vars SMAFast = series(SMA(Close, 5));
vars SMASlow = series(SMA(Close, 15));
if(crossOver(SMAFast, SMASlow))
enterLong(TrailingStopLong);
else if(crossUnder(SMAFast, SMASlow))
exitLong(TrailingStopShort);
//exit long and go short if 5 SMA crosses under 15 SMA
if(crossUnder(SMAFast, SMASlow))
enterShort();
else if(crossOver(SMAFast, SMASlow))
exitShort();
.......
Posted By: jcl
Re: WHY DOES THIS HAPPEN WHILE LIVE TRADING - 11/23/18 15:02
Something is wrong with your TMF parameter. You can use it for enterLong, but not for exitLong. Unexpected trades are probably caused by the Entry variable.