can someone please code a buy/sell (green/red arrows maybe) into this code? Thank you
function preMain()
{
setPriceStudy(true);
setStudyTitle("Simple Futures MA");
setCursorLabelName("FastMA", 0);
setCursorLabelName("SlowMA", 1);
setCursorLabelName("Filter", 2);
setDefaultBarFgColor(Color.blue, 0);
setDefaultBarFgColor(Color.red, 1);
setDefaultBarFgColor(Color.green, 2);
}
function main(Price, FastAvg, SlowAvg, AvgFltr)
{
if (Price == null) Price = "Close";
if (FastAvg == null) FastAvg = 9;
if (SlowAvg == null) SlowAvg = 50;
if (AvgFltr == null) AvgFltr = 80;
var FastMA = 0.0;//Average(Price, FastAvg);
var SlowMA = 0.0;//Average(Price, SlowAvg);
var Filter = 0.0;//Average(Price, AvgFltr);
var MaxLen = 0.0;
if (MaxLen <= FastAvg) MaxLen = FastAvg;
if (MaxLen <= SlowAvg) MaxLen = SlowAvg;
if (MaxLen <= AvgFltr) MaxLen = AvgFltr;
var vPrice = getValue(Price, 0, -MaxLen);
var i = 0;
for (i = 0; i < MaxLen; i++)
{
if (i < FastAvg) FastMA += vPrice[i];
if (i < SlowAvg) SlowMA += vPrice[i];
if (i < AvgFltr) Filter += vPrice[i];
}
FastMA /= FastAvg;
SlowMA /= SlowAvg;
Filter /= AvgFltr;
return new Array(FastMA, SlowMA, Filter);
}
function preMain()
{
setPriceStudy(true);
setStudyTitle("Simple Futures MA");
setCursorLabelName("FastMA", 0);
setCursorLabelName("SlowMA", 1);
setCursorLabelName("Filter", 2);
setDefaultBarFgColor(Color.blue, 0);
setDefaultBarFgColor(Color.red, 1);
setDefaultBarFgColor(Color.green, 2);
}
function main(Price, FastAvg, SlowAvg, AvgFltr)
{
if (Price == null) Price = "Close";
if (FastAvg == null) FastAvg = 9;
if (SlowAvg == null) SlowAvg = 50;
if (AvgFltr == null) AvgFltr = 80;
var FastMA = 0.0;//Average(Price, FastAvg);
var SlowMA = 0.0;//Average(Price, SlowAvg);
var Filter = 0.0;//Average(Price, AvgFltr);
var MaxLen = 0.0;
if (MaxLen <= FastAvg) MaxLen = FastAvg;
if (MaxLen <= SlowAvg) MaxLen = SlowAvg;
if (MaxLen <= AvgFltr) MaxLen = AvgFltr;
var vPrice = getValue(Price, 0, -MaxLen);
var i = 0;
for (i = 0; i < MaxLen; i++)
{
if (i < FastAvg) FastMA += vPrice[i];
if (i < SlowAvg) SlowMA += vPrice[i];
if (i < AvgFltr) Filter += vPrice[i];
}
FastMA /= FastAvg;
SlowMA /= SlowAvg;
Filter /= AvgFltr;
return new Array(FastMA, SlowMA, Filter);
}
Comment