Spread variable trouble
-
Hi, hope someone can spare some time to assist.
Just having some issues trying to get variables to work how I want, essentially all I am doing is trying to get the average spread filter to put the average spread value into a variable so I can see it working on the chart, then add that value + the offset and display that on the chart too.
Am a bit slow, can't figure it out. The comments are just displaying information on the chart to test it's all working.

-
I don't understand the logic on how to get the 'average spread'. How is it supposed to be calculated?
-
The spread filter has an average system built into it, you choose seconds and then an offset.
I just want to put the data into variable so I can see it function and tweak it.
So I want to use a long average spread, so keep under a pair volatility during news or close of the day. Say a daily average spread but right now I my variable doesn’t grab the spread so I can see it work. If I have a set spread that needs tweaking for every pair which I don’t want to do.
Spread filter uses seconds.
Ea input I use in minutes so, 1 x60 to convert it for the spread filter.
Offset of 10 for now while testing.I want to display the average spread on the chart.
The average + offset.How can I read what the spread filter is putting out in a variable form which I can modify and display?
-
You can do it with the comment block as per your example. However, I'm afraid what you want would require some custom code. The fxDreema option storing the spread is the one available on the 'market properties' category. That stores the value at this specific moment. What you want is an average value that required memorizing previous values from previous ticks. No block can do that automatically. You will definitely need custom code to get that calculation.
-
Thanks, you are very helpful and active here, its a shame because I initially thought as it is collecting the data in that block anyway I would be able to just ping it to a comment somewhere.
Probably will just have to do some back testing and see if it functions correctly. Thanks again
-
@Ipod @l-andorrà The spread value may differ between brokerage houses and it may not be the right decision to use this data in backtests. For the value you would use for each position though:
