hey guys, im a bit rusty with EFS, when i apply this to a chart, i dont see any trades occurring but i cant figure out whats wrong.
i am trading currencies by the way, thats what the Delta multiplier is for
i am trading currencies by the way, thats what the Delta multiplier is for
PHP Code:
function preMain() {
setStudyTitle("Test");
setCursorLabelName("return", 0);
setColorPriceBars(true);
setPriceStudy(true);
}
var LastEntry = null;
function main() {
var Delta = 10000;
if (getSymbol().match("JPY") == "JPY") Delta = 100;
if (Strategy.isLong() && high() >= LastEntry + (500 / Delta)) Strategy.doSell("", Strategy.LIMIT, Strategy.THISBAR, LastEntry + (500 / Delta))
if (Strategy.isLong() && low() <= LastEntry - (250 / Delta)) Strategy.doSell("", Strategy.LIMIT, Strategy.THISBAR, LastEntry - (250 / Delta))
if (Strategy.isShort() && low() <= LastEntry - (500 / Delta)) Strategy.doCover("", Strategy.LIMIT, Strategy.THISBAR, LastEntry - (500 / Delta))
if (Strategy.isShort() && high() >= LastEntry + (250 / Delta)) Strategy.doCover("", Strategy.LIMIT, Strategy.THISBAR, LastEntry + (250 / Delta))
if (getHour() == 0 && getMinute() == 0 && Strategy.isInTrade() == false() && sma(299) > sma(299,-1)) {
Strategy.doLong("", Strategy.LIMIT, Strategy.THISBAR, Strategy.DEFAULT, close())
LastEntry = close()
}
if (getHour() == 0 && getMinute() == 0 && Strategy.isInTrade() == false() && sma(299) < sma(299,-1)) {
Strategy.doShort("", Strategy.LIMIT, Strategy.THISBAR, Strategy.DEFAULT, close())
LastEntry = close()
}
setPriceBarColor(Color.RGB(128,128,128))
if(Strategy.isLong() == true) setPriceBarColor(Color.RGB(0,255,0))
if(Strategy.isShort() == true) setPriceBarColor(Color.RGB(255,0,0))
return sma(299);
}
Comment