Is it possible to calculate the difference between the high and low?

 
I want to calculate the difference between the high and low of the second last bar on the charts that are open on my screen and present as a display on the screen or chart itself? Is this possible? Will I need a script for this or indicator of EA?
 
Yes it's possible, it can be done in script, indicator or EA, it depends of your needs.
 

You can use either a script, indy or an EA, but it's best to use EA's as they have their own thread so it doesn't affect the GUI thread.

What you ask isn't perfunctory because you need to scan the charts you have open, which is a question unto itself. You could attach an EA to each chart, but that's not the best method. It's better to attach a master EA to only one chart and then it can scan all other charts you have open and do as you need.

const int LOOK_BACK = 2; // which candle to target
MqlRates rates[];
ArraySetAsSeries(rates, true); // set array so newest candle is array[0]
double c2Hi, c2Lo, diff;
int copied = CopyRates(_Symbol, _Period, 0, LOOK_BACK, rates);

if (copied >= LOOK_BACK) {
   c2Hi = rates[LOOK_BACK-1].high; // arrays are zero-based, so subtract 1
   c2Lo = rates[LOOK_BACK-1].low;
   diff = (c2Hi - c2Lo) / Point(); // use Point() to get the symbols decimal places
   printf("c2Hi:%g c2Lo:%g diff:%g", c2Hi, c2Lo, diff); // c2Hi:1.13757 c2Lo:1.0814 diff:5617
}

N.B. The difference is in pipettes, so divide by 10 if you want pips (562pips)
 
pipsqueak1:

You can use either a script, indy or an EA, but it's best to use EA's as they have their own thread so it doesn't affect the GUI thread.

What you ask isn't perfunctory because you need to scan the charts you have open, which is a question unto itself. You could attach an EA to each chart, but that's not the best method. It's better to attach a master EA to only one chart and then it can scan all other charts you have open and do as you need.

Thank you!