Current location | Thread information | |
![]() ![]() ![]() ![]() ![]() ![]() |
Last Activity 7/6/2025 3:47 AM 10 replies, 8474 viewings |
|
|
Printer friendly version |
^ Top | |||
JB![]() Legend ![]() ![]() ![]() ![]() ![]() Posts: 434 Joined: 6/6/2006 ![]() |
Can some one help? I should like to create a simple indicator to plot a horizontal line/s at a particular values irrespective of the ohlc price. So for example to plot a line on the current dow $DJI at say 10100? I would like to highlight say the round 100 values between 10000 and 10400. Does the plotpricetrenline have to be used or can it be accomplished with the plotprice command? Then can this be coupled to the current value so as to higlight the hundred lines above and below the current price with adjusment following the price accross the levels. [Edited by JB on 1/23/2010 4:41 PM] | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
Dim lineval as single lineval =10100 plotprice("fxdval", lineval) | ||
^ Top | |||
JB![]() Legend ![]() ![]() ![]() ![]() ![]() Posts: 434 Joined: 6/6/2006 ![]() |
jim thanks the value cannot be a numeral direct you have to dim a variable for the number with the plotprice .. Have I got it right now? [Edited by JB on 1/23/2010 5:33 PM] | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
Not sure did not test. On iPhone all day. Try it and find out! :-)) | ||
^ Top | |||
Matthew Greenslet![]() Idol ![]() ![]() ![]() ![]() Posts: 2077 Joined: 2/27/2006 ![]() |
Jim's code is one way. That will plot an indicator line across the price chart at a fixed value. PlotPrice("FixVal", 10100) would work just the same. Also if you wanted to make the level user selectable rather than hard coding it you could use a parameter. #Indicator #PARAM "PriceLevel", 10100, 1, 20000 PlotPrice("FixedVal", PriceLevel) Return PriceLevel There are several OL plot functions which can be found by selecting 'Plotting" from the section filter dropdown. If you are wanting to render this line in the price pane you can use PlotPrice, or PlotPriceTrendline. If either of these functions are used to plot a different indicator value this will set the default internal pane from an indicator pane to the price pane. After which you could also use PlotLabel (if no other plotting is done this will plot in an indicator pane). PlotPrice will plot an indicator line in the price chart. If you want to specify the starting and ending point of the line you can use PlotTrendLine. PlotLabel will draw a non-selectable line at a specified price and list the price in the scale on the left. Alternatively if you are just drawing a price line on the price you can just use the drawing tools to draw multiple types of trendlines (segment, ray, or line). Trendlines might be a more versatile solution since you can set trendlines to alert lines to play a sound and/or display a message box when they are violated. | ||
^ Top | |||
ap·pren·ticeGuru![]() Veteran ![]() Posts: 123 Joined: 10/22/2010 Location: Columbia, MD ![]() |
Hello, Can anyone please help in re-writing Mathew's code to include drawing multiple horizontal lines, instead of using duplicating option ? Thanks. [Edited by ap·pren·ticeGuru on 12/27/2015 5:53 PM] | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
How many lines do you want to draw? Do you want them to be evenly spaced, with a centerline input and input for the gap and input for the count? Or totally arbitrary prices, each specified by the input? Or maybe some kind of fibonacci or geometric spacing? Do you want to specify begin &/or end dates/times, or just have them plot from the first thru the last bar? | ||
^ Top | |||
ap·pren·ticeGuru![]() Veteran ![]() Posts: 123 Joined: 10/22/2010 Location: Columbia, MD ![]() |
Thanks Jim, Nothing fancy :-), but need a total of minimum of 4 horizontal lines drawn to max of 8 as needed (but not important - the 8), that are totally arbitrary prices each specified by the input, and just plotted from 1st thru last bar. Not important, but if possible, be able to change color and the "solid, dash, dot" options of each line would help. Thanks+ for your help. | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
Here you go. Limitations: OLang does not permit specification of the line style (dash dot). It does allow the color to be specified, and the line width. However, you can double click on the plotted line and set the color and style that way. Coding for alternative colors is sort of messy, so I'll leave it up to you to use the double click method (default will be random colors). Instructions: type in the price to be plotted. If you leave an input blank, it will be ignored. #Indicator #param "Price1", 0 #param "Price2", 0 #param "Price3", 0 #param "Price4", 0 #param "Price5", 0 #param "Price6", 0 #param "Price7", 0 #param "Price8", 0 if Price1 > 0 then PlotPrice("P1",Price1) if Price2 > 0 then PlotPrice("P2",Price2) if Price3 > 0 then PlotPrice("P3",Price3) if Price4 > 0 then PlotPrice("P4",Price4) if Price5 > 0 then PlotPrice("P5",Price5) if Price6 > 0 then PlotPrice("P6",Price6) if Price7 > 0 then PlotPrice("P7",Price7) if Price8 > 0 then PlotPrice("P8",Price8) return 0 | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
P.S: If you want to specify color and line width: PlotPrice("P1",Price1,green,3) ... where line width is 1-10 and color options are listed here: For the 256 colors ... Click here To change things manually ... Click here [Edited by Jim Dean on 12/27/2015 7:04 PM] | ||
^ Top | |||
ap·pren·ticeGuru![]() Veteran ![]() Posts: 123 Joined: 10/22/2010 Location: Columbia, MD ![]() |
Thanks Jim, here is a sample for all, plus there could be other possibilities for personal customizing... #Indicator #param "ClosingPrice", 0 #param "PrevHIGH", 0 #param "PrevLOW", 0 #param "GlobexHIGH", 0 ' or pre-market high #param "GlobexLOW", 0 ' or pre-market low #param "Bearish", 0 #param "Neutral", 0 #param "Bullish", 0 if ClosingPrice > 0 then PlotPrice("Close",ClosingPrice) if PrevHIGH > 0 then PlotPrice("PrevHigh",PrevHIGH) if PrevLOW > 0 then PlotPrice("PrevLOW",PrevLOW) if GlobexHIGH > 0 then PlotPrice("GlobexHIGH",GlobexHIGH) ' or pre-market high if GlobexLOW > 0 then PlotPrice("GlobexLOW",GlobexLOW) ' or pre-market low if Bearish > 0 then PlotPrice("Bearish",Bearish) if Neutral > 0 then PlotPrice("Neutral",Neutral) if Bullish > 0 then PlotPrice("Bullish",Bullish) return 0 [Edited by ap·pren·ticeGuru on 12/29/2015 4:30 AM] |
|
|
Legend | Action | Notification | |||
Administrator
Forum Moderator |
Registered User
Unregistered User |
![]() |
Toggle e-mail notification |