percentage calculation daily month formula

 
Good morning,
I am looking to expand some things to my indicator but I'm struggling, I ask you kindly support, although I imagine many things are banality.

1: you can write the formula to put my function (already entered in the editor) to calculate the percentage deviation daily and monthly (the insert in two different functions)
ES: This is the formula that I calculated the percentage deviation from a point that interests me, at the current market price (bid)
double r = ((100 / Livello_Base) * Bid) -100;

2: and you can also have a formula that I spred the calculations?

3: I would like to insert a rectangular shape on the left side of the graph but it remains in the foreground, so that I can put in evidenta all the data that I'm creating, but how? I've xy variable, so that it can change it at will

There irngrazio for 'assistance
Reason: