Pls tell me the code for:

#1
Pls tell me the AMI code for :
I need to plot volume for each candle...
condition is : if previous bar high is less than current bar close , volume should be positive.
if previous bar high is greater than current bar close, volume should be negative.

eg: volume if present bar is say 7000,
previous bar high is 7856 , present bar close is 7865 then volume is 7000
previous bar high is 7885 , present bar close is 7870 then volume is -7000

thanks for ur support.:thumb:
 

mittens

Active Member
#2
Pls tell me the AMI code for :
I need to plot volume for each candle...
condition is : if previous bar high is less than current bar close , volume should be positive.
if previous bar high is greater than current bar close, volume should be negative.

eg: volume if present bar is say 7000,
previous bar high is 7856 , present bar close is 7865 then volume is 7000
previous bar high is 7885 , present bar close is 7870 then volume is -7000

thanks for ur support.:thumb:
factor = Ref(High,-1) < Close - Ref(High,-1) > Close;
changedVolume = Volume * factor;