Hello, My first post using Zorro S 1.10 to create my first script. My experience includes many years of programming in many different languages some very similar to, but not c++. So below is my programming exercise. Just an exercise no trading involved, yet. The purpose of the script is to create an oscillator and display it. Note: that it is not complete and does NOT work properly. It is definitely a work in progress. During the writing I discovered the debug method and included it. Then I thought, "can't this be used as a function to be called from many areas of a script?". So I created a function passed the variables I wanted and displayed the message. and what I get is in the attached .jpg file. What is happening is the message is getting passed , but the msg( command is not interpreting it as an instruction, but the message box just displays the message string as passed, including the quotes and the Yes or No. If I select no it will stop the script just like it is supposed to. The text displayed in the box is not correct. If someone will kindly explain how to include a jpeg in line of the message that would be helpful also. The code is included below. Not quite sure what to make of this. Helpful suggestions are being accepted. Thanks P
static int prevosc = 50;//first osc value should be 50 after we use the previous value static int debug = 1;//for debugging change to 0 to stop static int goon = 0;//for debug messages static string quote = "\"";
function Oscar() { //this function will determine the Osc value for current pair //it is for the 15 min chart and displays on a page of it's own. //the formulas for OSC is: //A= Highest High for last 8 periods //B= Lowest Low of last 8 periods //D= last closing price //X= previous Oscillator value init to 50 // formula is ((x/3)*2 + ((d-b/a-b)*100)/3)
vars H = series(priceHigh(),8), L = series(priceLow(),8), C = series(priceClose());
double A = H[0]; double B = L[0]; double D = C[0];
double oscarvalue =((prevosc / 3)*2) + ((D - B / A - B) * 100) / 3;
if(debug ) { string messp1 = "P = %i H = %.5f L = %.5f C = %.5f oscarvalue = %.3i"; string messp2 = ",prevosc,A,B,D,oscarvalue"; Displaydebugmsg (messp1, messp2); }
//use oscarvalue for next computation prevosc = oscarvalue; return(oscarvalue); }