Strategy Object |
Top Previous Next |
Strategy Object
The Strategy Object allows EFS scripts to communicate with the eSignal Strategy Analyzer and perform backtests of trading systems.
Strategy Methods
Strategy.doLong(Description, Fill Type, Fill Bar, LotSize, StopOrLimit) Strategy.doSell(Description, Fill Type, Fill Bar, LotSize, StopOrLimit) Strategy.doCover(Description, Fill Type, Fill Bar, LotSize, StopOrLimit) Strategy.doShort(Description, Fill Type, Fill Bar, LotSize, StopOrLimit) Strategy.isInTrade() Strategy.isLong() Strategy.isShort() Strategy.setStop(dStop) Strategy.clearStop() Strategy.getPositionSize() Strategy.getDefaultLotSize()
Fill Type Constants
Fill Bar Constants
LotSize Constants
Notes
Usage
//assume a default lot size of 100
//go long 100 shares at the closing value of the current bar. Strategy.doLong( "Go Long", Strategy.CLOSE, Strategy.THISBAR );
//go long 100 shares at the closing value of the current bar. Strategy.doLong( "Go Long", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT );
//Limit order to go long 100 shares @ $20 if the low of the current bar is <= 20. Strategy.doLong( "Go Long", Strategy.LIMIT, Strategy.THISBAR, null, 20 );
//If long, issue a stop sell order if high of the current bar >= 30. if( Strategy.isLong() ) { Strategy.doSell( "Close Long", Strategy.STOP, Strategy.THISBAR, Strategy.ALL, 30 ); }
//Set a stop order to sell all shares if high of any bar at or after the current bar >= 30. Strategy.setStop( 30 );
|