The standard answer in this forum to posts like yours, where you describe what you want without any display of effort (and I am not saying you haven't tried - it's just that we need an indication of your attempt), is to either pay someone to do it or learn to do it yourself.
If, after an indication of a legitimate attempt, you are still struggling, share your code and the community will help you.
Cheers
Hey Guys,
I seem to be pulling my hair out on this one. All I would like to do is have an indicator in a new window measuring the spread between two pairs by drawing a line with it's price?
Could anyone help with this?
Any suggestions are welcome.
Thanks
Dean
Doubt that you have tried as the solution(s) are rather simple
Start with
double bid =MarketInfo(Symbol(),MODE_BID); // Request for the value of Bid double ask =MarketInfo(Symbol(),MODE_ASK);
The standard answer in this forum to posts like yours, where you describe what you want without any display of effort (and I am not saying you haven't tried - it's just that we need an indication of your attempt), is to either pay someone to do it or learn to do it yourself.
If, after an indication of a legitimate attempt, you are still struggling, share your code and the community will help you.
Cheers
Thanks for the reply, below is my attempt, however, I want to use Ask and Bid prices? Is it possible? :/
#property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Black #property indicator_minimum 0 //---- buffers double Spread[]; double XPrice[]; double YPrice[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorShortName("spread"); IndicatorDigits(Digits - 3); IndicatorBuffers(3); SetIndexBuffer(0, Spread); SetIndexBuffer(1, XPrice); SetIndexBuffer(2, YPrice); SetIndexStyle(0, DRAW_LINE); SetIndexLabel(0, "spread"); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i, counted_bars = IndicatorCounted(); //---- check for possible errors if(counted_bars < 0) return(-1); //---- last counted bar will be recounted if(counted_bars > 0) counted_bars--; int limit = Bars - counted_bars; for(i = 0; i < limit; i++) { XPrice[i] = NormalizeDouble(iClose("X",0,i),2); YPrice[i] = NormalizeDouble(iClose("Y",0,i),2); } for(i = limit - 1; i >= 0; i--) { Spread[i] = XPrice[i] - YPrice[i]; } //---- return(0); }
Thanks in advance...,
#property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 DodgerBlue extern string SecondSymbol = "WTI"; double ExtSpreadBuffer[]; //+------------------------------------------------------------------+ int OnInit(void) { IndicatorBuffers(1); IndicatorDigits(Digits); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtSpreadBuffer); return(INIT_SUCCEEDED); } int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int i,limit; for(i=limit; i<rates_total; i++) { datetime timeNow = iTime(Symbol(), 0, i); ExtSpreadBuffer[i] = iClose(Symbol(), 0, i) - iClose(SecondSymbol, 0, iBarShift(SecondSymbol, 0, timeNow)); } return(rates_total); }A very raw version just to show the idea.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey Guys,
I seem to be pulling my hair out on this one. All I would like to do is have an indicator in a new window measuring the spread between two pairs by drawing a line with it's price?
Could anyone help with this?
Any suggestions are welcome.
Thanks
Dean