need help for auto-trading system triggered by buy/sell signal

#1
I would like to place order whenever there is buy signal. My code:

===============================

cMA = MA(Close,19);
pMA = ref(MA( Close, 2),-1);

Buy=cMA>pMA;

if(Buy){

placeorder();

}

===============================

The error is, "Buy" is an array, not a numberic or boolean type.

How can I correct this?


Thanks for any help :)
 

extremist

Well-Known Member
#2
I would like to place order whenever there is buy signal. My code:

===============================

cMA = MA(Close,19);
pMA = ref(MA( Close, 2),-1);

Buy=cMA>pMA;

if(Buy){

placeorder();

}

===============================

The error is, "Buy" is an array, not a numberic or boolean type.

How can I correct this?


Thanks for any help :)

Code:
cMA = MA(Close,19);
pMA = ref(MA( Close, 2),-1);

Buy=WriteIf(cMA>pMA,"one","n");

if(Buy=="one")
{

placeorder();

}
This will work.
 

Similar threads