Why will this code execute the IB Buy:
if(getBarState() == BARSTATE_NEWBAR) {
if(vStoch.getValue(StochStudy.FAST,-2) < vStoch.getValue(StochStudy.SLOW,-2)&&
vStoch.getValue(StochStudy.FAST,-1) > vStoch.getValue(StochStudy.SLOW,-1)){
Alert.addToList(getSymbol(),"BUY S21 (Crossing Up)",Color.black,Color.blue);
trade.Buy(getSymbol(), 1, IBBroker.MARKET);
}
and not this one:
if ((nsignal > 0)) {
nNewTrade = 0;
drawShapeRelative(0, low() -1.25, Shape.UPARROW, null, Color.green, Shape.ONTOP, getValue("rawtime") + "B");
if (LongEntryOption == 0) {
Strategy.doLong("Go Long", Strategy.MARKET, Strategy.NEXTBAR, DefEntryContracts);
Alert.addToList(getSymbol(),"BUY MA 10e-15e (Crossing Up)",Color.black,Color.blue);
trade.Buy(getSymbol(), 1, IBBroker.MARKET);
ProfitTargetStage = 0;
TradeType = 1;
Of course ' var trade = new IBBroker; ' is declared in both cases.
In both cases the Alert is properly being shown.
Thank you for your help...
Cheers,
Andrei
if(getBarState() == BARSTATE_NEWBAR) {
if(vStoch.getValue(StochStudy.FAST,-2) < vStoch.getValue(StochStudy.SLOW,-2)&&
vStoch.getValue(StochStudy.FAST,-1) > vStoch.getValue(StochStudy.SLOW,-1)){
Alert.addToList(getSymbol(),"BUY S21 (Crossing Up)",Color.black,Color.blue);
trade.Buy(getSymbol(), 1, IBBroker.MARKET);
}
and not this one:
if ((nsignal > 0)) {
nNewTrade = 0;
drawShapeRelative(0, low() -1.25, Shape.UPARROW, null, Color.green, Shape.ONTOP, getValue("rawtime") + "B");
if (LongEntryOption == 0) {
Strategy.doLong("Go Long", Strategy.MARKET, Strategy.NEXTBAR, DefEntryContracts);
Alert.addToList(getSymbol(),"BUY MA 10e-15e (Crossing Up)",Color.black,Color.blue);
trade.Buy(getSymbol(), 1, IBBroker.MARKET);
ProfitTargetStage = 0;
TradeType = 1;
Of course ' var trade = new IBBroker; ' is declared in both cases.
In both cases the Alert is properly being shown.
Thank you for your help...
Cheers,
Andrei
Comment