OmniTrader Professional Forum
-
OmniScripts
indicator of wave trader as a signal |
| ^ Top | ||
| beech pilot Posts: 37 Joined: 11/1/2018 Location: Visalia User Profile | would like to add to the indicator when the ema 9 crosses the pricetrendline as a system as of now the indicator plots a price and bar when the wave changes color, i would like to change it as a indicator into a system thanks #Indicator dim s as string s = cstr(c[1]) If (CAW_ZZ(2.5,14) > 0 and CAW_ZZ(2.5,14)[1] < 0) then PlotText("WTChange", C-(2*ATR(14)), s) PlotPriceTrendLine( "Level", BAR, Close, BAR+20, close, blue, 3) Else If (CAW_ZZ(2.5,14) < 0 and CAW_ZZ(2.5,14)[1] > 0)then PlotText("WTChange", c+(2*ATR(14)), s) PlotPriceTrendLine( "Level", BAR, Close, BAR+20, close, blue, 3) End If Return 0 ' Return the value calculated by the indicator Attached file : 4-16-2022 7-42-40 AM.jpg (182KB - 617 downloads) | |
| ^ Top | ||
| Jim Dean Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA User Profile | I couldn’t really follow the first part of your post - sort of garbled. But here’s how you change the indicator you provided into a system. Maybe that will get you started. #system dim s as string s = cstr(c[1]) If (CAW_ZZ(2.5,14) > 0 and CAW_ZZ(2.5,14)[1] < 0) then PlotText("WTChange", C-(2*ATR(14)), s) PlotPriceTrendLine( "Level", BAR, Close, BAR+20, close, blue, 3) Signal = LongSignal Else If (CAW_ZZ(2.5,14) < 0 and CAW_ZZ(2.5,14)[1] > 0)then PlotText("WTChange", c+(2*ATR(14)), s) PlotPriceTrendLine( "Level", BAR, Close, BAR+20, close, blue, 3) Signal = ShortSignal End If | |
| ^ Top | ||
| beech pilot Posts: 37 Joined: 11/1/2018 Location: Visalia User Profile | Thanks Jim. however it will not compile here is what i get Attached file : 4-16-2022 8-53-53 AM.jpg (47KB - 581 downloads) | |
| ^ Top | ||
| Jim Dean Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA User Profile | Please use the corrected code. Was still waking up when I first posted. Sorry about that. | |
| ^ Top | ||
| beech pilot Posts: 37 Joined: 11/1/2018 Location: Visalia User Profile | Thanks Jim is it possible to get the longsignal to occur when the ema9 > pricetrendline and short signal when ema9 < pricetrendline pic included Attached file : 4-16-2022 10-55-19 AM.jpg (57KB - 624 downloads) Attached file : 4-16-2022 10-55-19 AM.jpg (57KB - 582 downloads) | |
| ^ Top | ||
| Jim Dean Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA User Profile | I don’t recall the syntax for “pricetrendline” - not sure what plug-in it comes from. But here is “pseudocode” for what you asked - you’ll need to replace pricetrendline with whatever syntax and params you prefer. #system dim s as string s = cstr(c[1]) If (CAW_ZZ(2.5,14) > 0 and CAW_ZZ(2.5,14)[1] < 0 and EMA(9) > pricetrendline ) then PlotText("WTChange", C-(2*ATR(14)), s) PlotPriceTrendLine( "Level", BAR, Close, BAR+20, close, blue, 3) Signal = LongSignal Else If (CAW_ZZ(2.5,14) < 0 and CAW_ZZ(2.5,14)[1] > 0 and EMA(9) < pricetrendline ) then PlotText("WTChange", c+(2*ATR(14)), s) PlotPriceTrendLine( "Level", BAR, Close, BAR+20, close, blue, 3) Signal = ShortSignal End If | |
| ^ Top | ||
| beech pilot Posts: 37 Joined: 11/1/2018 Location: Visalia User Profile | the pricetrendline is the horizontal blue line. PlotPriceTrendLine( "Level", BAR, Close, BAR+20, close, blue, 3) unfortunately i dont know what that would be to give it that condition | |
| ^ Top | ||
| Jim Dean Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA User Profile | Ah ok. Simple. That line is just at the closing price of the current bar. #system dim s as string s = cstr(c[1]) If (CAW_ZZ(2.5,14) > 0 and CAW_ZZ(2.5,14)[1] < 0 and EMA(9) > C ) then PlotText("WTChange", C-(2*ATR(14)), s) PlotPriceTrendLine( "Level", BAR, Close, BAR+20, close, blue, 3) Signal = LongSignal Else If (CAW_ZZ(2.5,14) < 0 and CAW_ZZ(2.5,14)[1] > 0 and EMA(9) < C ) then PlotText("WTChange", c+(2*ATR(14)), s) PlotPriceTrendLine( "Level", BAR, Close, BAR+20, close, blue, 3) Signal = ShortSignal End If | |
| ^ Top | ||
| Jim Dean Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA User Profile | Please note that your snapshot captions appear to be BACKWARDS from what the signal triangle is indicating. If you want the code to match your drawing and not your posted description, reverse the > and < in the EMA(9) clauses. | |
| ^ Top | ||
| beech pilot Posts: 37 Joined: 11/1/2018 Location: Visalia User Profile | unfortunately still not correct Attached file : 4-16-2022 12-59-12 PM.jpg (81KB - 616 downloads) Attached file : 4-16-2022 12-59-12 PM.jpg (81KB - 568 downloads) | |
| ^ Top | ||
| beech pilot Posts: 37 Joined: 11/1/2018 Location: Visalia User Profile | ok i will try this | |
| ^ Top | ||
| beech pilot Posts: 37 Joined: 11/1/2018 Location: Visalia User Profile | systems arrows do not plot at the blue line when ema9 > or < the C or blue line they plot at wave change still | |
| ^ Top | ||
| Jim Dean Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA User Profile | I can’t decipher what you are saying. Why not try modifying the code yourself a bit? | |
| ^ Top | ||
| beech pilot Posts: 37 Joined: 11/1/2018 Location: Visalia User Profile | thanks Jim for the help what you have done i will seek another avenue to get this finished, | |
| ^ Top | ||
| Ryan Olson Posts: 170 Joined: 12/29/2006 Location: Austin, Tx User Profile | Beech Pilot - I think I get what you are looking for - some of this was a bit confusing as PlotPrice is only a visual plot however, since it was using the close price of the “Color Change” bar, we simply need to store that in a variable to be used later. Hope this helps. #system #Param "Extend", 3 #Param "Periods", 9 dim level as single dim s as string s = cstr(c[1]) if CAW_ZZ(2.5,14) = -1 and CAW_ZZ(2.5,14)[1] = 1 then level = C PlotPriceTrendLine( "Level", BAR, Close, BAR+Extend, close, blue, 3) End if If CAW_ZZ(2.5,14) = -1 and EMA(Periods) > level and EMA(Periods)[1] < level then PlotText("WTChange", C-(2*ATR(14)), s) Signal = LongSignal end if if CAW_ZZ(2.5,14) = 1 and CAW_ZZ(2.5,14)[1] = -1 then level = C PlotPriceTrendLine( "Level", BAR, Close, BAR+Extend, close, blue, 3) End if If CAW_ZZ(2.5,14) = 1 and EMA(Periods) < level and EMA(Periods)[1] > level then PlotText("WTChange", C-(2*ATR(14)), s) Signal = ShortSignal end if Plotprice("EMA", EMA(Periods), blue, 3) | |
| ^ Top | ||
| beech pilot Posts: 37 Joined: 11/1/2018 Location: Visalia User Profile | 100 percent what i needed . You nailed it perfectly Ryan. Obviously the pics were very straight forward thanks a ton | |
| ^ Top | ||
| nawaz Posts: 2 Joined: 5/16/2016 Location: SURREY BC CANADA User Profile | thank you | |