Really appreciate the help on this. Also not a developer so I'm bangiing my head every step of the way and reading the maunal as much as posible.

Sample code. How do I reset the Count in the loop to 1.

function run()
{
set(LOGFILE|PLOTNOW|BALANCE|OPENEND);
StartDate = 2016;
EndDate = 2017;
BarPeriod = 5;
LookBack = 5000;
LotAmount = 0.1; //1000 or 0.1;
vars Prices = series(priceClose(0));
vars SMA100 = series(SMA(Prices,100));
vars SMA30 = series(SMA(Prices,30));
LotAmount = 0.1;
Lots = 1;
var Count = 1;

for(closed_trades)
{
if (crossOver(SMA30,SMA100))
Count++;
else if (crossUnder(SMA30,SMA100))
Count = 1; //Trying to reset counter to 1 for loop but no luck

}

if(crossOver(SMA30,SMA100))
{
enterLong(Count);
}

if(crossUnder(SMA30,SMA100))
{
enterShort(Count);
}

plot("SMA",SMA30,0,RED);
plot("SMA",SMA100,0,BLUE);
plot("Count",Count,NEW,BLUE);
plot("Lots",Lots,NEW,BLUE);

}

I'll take other creative ideas as well.