in addtocomposite null values are replaced with zero but how to create composite by replacing null with previous bar value
All kind of "keep previous value" thing can be done using ValueWhen function http://www.amibroker.com/f?valuewhen and ValueWhen - how to use
data = ValueWhen( NOT IsNull( data ), data );
Then you can use
data as input for AddToComposite.
Thanks for your reply,
i want to add array(say close) of five stocks and then plot composite in chart
but after doing as you said ,when no data is available it is taking zero for tha minute bar.
stock A 100 101 101.5 102
stock B 20.2 20 x 20 (x means no data bar available)
composite 120.2 121 101.5 122
i need 120.2 121 121.5 122
Yet another example when user only in second post explains what he is really doing. If you did that in first place you would save your time and other peoples time too. In short turn ON Pad And Align (the option in the Analysis Settings dialog). Search the forum: Need Help in Addtocomposite
and KB http://www.amibroker.org/userkb/2007/06/26/data-holes-in-real-time-trading/ - this has plenty of information and last but not least Users' Manual:
Quote from Users' Manual:
Pad and align to reference symbol
When this is turned on, all symbols' quotes are padded and aligned to reference symbol. Note: by default this setting is OFF. Use responsibly. It may slow down backtest/exploration/scan and introduce some slight changes to indicator values when your data has holes and holes are filled with previous bar data. The feature is intended to be used when your system uses general market timing (generates global signals based on data and/or indicators calculated using Foreign from 'reference' symbol) or when you are creating composites out of unaligned data. Note: if reference symbol does not exist, data won't be padded.
Same mistake will not happen again