Reply To: Assistance with a script

Optuma Forums Optuma Scripting Assistance with a script Reply To: Assistance with a script

#54111
Avatar
Trevor R
  • Topics: 56
  • Replies: 178
  • Posts: 234

Hi Karen,

Your problem lies in the relationships between the values you are comparing. I’ve rearranged your script a little to make it easier for me to follow when trying to analyse what is going on and I’ve commented out lines that are not being used in the SHOWPLOT lines in the following screenshot. The SHOWPLOT lines are:

  • Close(0):   Green
  • V2:    Blue
  • Mid1:   Red
  • Range0:   Orange
  • RangeAvg:   Lime

20190722 Karen's Script, Ticket #54107

As you can see from the above screenshot:

  • Close(0) (Green) is never less than V2 (Blue), so “Close(0) < V2” will always result in FALSE (=0)
  • Close(0) (Green) is never less than Mid1 (Red), so “Close(0) < Mid1” will always result in FALSE (=0)
  • Range0 (Orange) oscillates above and below RangeAvg (Lime), so “Range0 > RangeAvg” will offer TRUE (=1) results.

Given the foregoing results, RedEnabled 1 and RedEnable2 will always return a FALSE result.

Here is the script as I’ve modified it:

// Selling volume shown with red Divisor =5

Mid0= (High(0)+Low(0))/2;

Range0 = HIGH(0) – LOW(0);

RangeAvg= MA(Range0, BARS= 50, STYLE=Simple);

High1= HIGH(1); Low1= LOW(1);

Mid1= (High1 – Low1)/2;

//V1 = Mid1 + (High1-Low1)/5;

V2 = Mid1 – (High1 – Low1)/5;

//VolumeAvg = MA(VOL(0), BARS= 50, STYLE=Simple);

//Red color volume bar

//RedEnabled1 = (Range0 > RangeAvg) and (Close(0) < V2);

//RedEnabled2 = Close(0) < Mid1;

//if((RedEnabled1) or (RedEnabled2),1,0);

//

Plot1=Close(0);

Plot1.Colour = Green;

//

Plot2 = v2;

Plot2.Colour = Blue;

//

Plot3 = Mid1;

Plot3.Colour = Red;

//

Plot4 = Range0;

Plot4.Colour = Orange;

//

Plot5 = RangeAvg;

Plot5.Colour = Lime;

I haven’t really discerned exactly what you are trying to achieve with your script, but I hope this explanation of what is happening within your script and demonstrating a way to show the intermediate results will assist you in achieving your aim.

Cheers

Trevor

The Auld Tyma at

Auld Tyma Data Logo with URL 1 cm

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close