I've been trying to add a simple MA to the OBV. In the past I've been able to modify studies but cannot figure out how to do this. Tried modifying the OBV in the library folder without success. Can anyone help?
Thanks
Rod
Thanks
Rod
//this logic based on direction change of the MA
if(getBarState()==BARSTATE_NEWBAR){//if at a new bar
if(vMAofOBV.getValue(MAStudy.MA,-1)>vMAofOBV.getValue(MAStudy.MA,-2)&&//prior MA > MA 2 bars back and
vMAofOBV.getValue(MAStudy.MA,-2)<vMAofOBV.getValue(MAStudy.MA,-3)){//MA 2 bars back < MA 3 bars back
Alert.playSound("ding.wav");//play sound
}
//reverse logic for falling MA
}
//this logic based on the cross of MA and OBV
if(getBarState()==BARSTATE_NEWBAR){//if at a new bar
if(vMAofOBV.getValue(MAStudy.MA,-1)>vOBV.getValue(OBVStudy.OBV,-1)&&//prior MA > prior OBV and
vMAofOBV.getValue(MAStudy.MA,-2)<vOBV.getValue(OBVStudy.OBV,-2)){//MA 2 bars back < OBV 2 bars back
Alert.playSound("ding.wav");//play sound
}
//reverse logic for crossing under
}
if(vOBV.getValue(OBVStudy.OBV)>vMAofOBV.getValue(MAStudy.MA)){
setBarFgColor(Color.green,0);
}else{
setBarFgColor(Color.red,0);
}
Comment