this strategy goes long when price crosses above LSMA
and should go to cash when price drops below LSMA.
it only makes a single trade. eg. for NOV, entry is 1/4/10 and
never exits, but runs to current date.
if ( close() > LSMA_Array[0] ) {
Strategy.doLong ("Long", Strategy.CLOSE, Strategy.THSBAR);
}else{
Strategy.doSell("Cash", Strategy.CLOSE,Strategy.THISBAR);
}
can anyone advise me where i'm going wrong?
thanks,
peter.
and should go to cash when price drops below LSMA.
it only makes a single trade. eg. for NOV, entry is 1/4/10 and
never exits, but runs to current date.
if ( close() > LSMA_Array[0] ) {
Strategy.doLong ("Long", Strategy.CLOSE, Strategy.THSBAR);
}else{
Strategy.doSell("Cash", Strategy.CLOSE,Strategy.THISBAR);
}
can anyone advise me where i'm going wrong?
thanks,
peter.
Comment