eSignal 7.1 example
function preMain()
{
setPriceStudy(true);
setStudyTitle("MA50 System");
setCursorLabelName("MA50", 0);
}
var study = new MAStudy(50, 0, "Close", MAStudy.SIMPLE);
var f = new File("C:\TradeBullet\Order1.tb");
function main()
{
var v = study.getValue(MAStudy.MA);
if(v == null)
return;
f.open("at+"); // Open and append
if(!f.isOpen()) {
debugPrintln("Could not open C:\TradeBullet\Order1.tb ");
}
if(close() >= v)
{
if(!Strategy.isLong())
{
Strategy.doLong("Crossing Up", Strategy.MARKET, Strategy.THISBAR);
f.writeln(" place,Simulator,MSFT,ISLAND,BUY,1000,Market,0,0,day,,, MA50 System ");
}
}
else
{
if(!Strategy.isShort())
{
Strategy.doShort("Crossing Down", Strategy.MARKET, Strategy.THISBAR);
f.writeln( " place,Simulator,MSFT,ISLAND,SELL,1000,Market,0,0,day,,, MA50 System" );
}
}
if (Strategy.isLong())
{
setBarBgColor(Color.green);
}
else if(Strategy.isShort())
{
setBarBgColor(Color.red);
}
f.close();
return v;
}