Current location | Thread information | |
![]() ![]() ![]() ![]() ![]() ![]() |
Last Activity 9/1/2024 11:18 PM 16 replies, 1308 viewings |
|
|
Printer friendly version |
^ Top | |||
beech pilot![]() Member ![]() Posts: 36 Joined: 11/1/2018 Location: Visalia ![]() |
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 [Edited by beech pilot on 4/16/2022 9:59 AM] ![]() | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
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 [Edited by Jim Dean on 4/16/2022 10:43 AM] | ||
^ Top | |||
beech pilot![]() Member ![]() Posts: 36 Joined: 11/1/2018 Location: Visalia ![]() |
Thanks Jim. however it will not compile here is what i get ![]() | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
Please use the corrected code. Was still waking up when I first posted. Sorry about that. | ||
^ Top | |||
beech pilot![]() Member ![]() Posts: 36 Joined: 11/1/2018 Location: Visalia ![]() |
Thanks Jim is it possible to get the longsignal to occur when the ema9 > pricetrendline and short signal when ema9 < pricetrendline pic included ![]() ![]() | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
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![]() Member ![]() Posts: 36 Joined: 11/1/2018 Location: Visalia ![]() |
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![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
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 [Edited by Jim Dean on 4/16/2022 2:53 PM] | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
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![]() Member ![]() Posts: 36 Joined: 11/1/2018 Location: Visalia ![]() |
unfortunately still not correct ![]() ![]() | ||
^ Top | |||
beech pilot![]() Member ![]() Posts: 36 Joined: 11/1/2018 Location: Visalia ![]() |
ok i will try this | ||
^ Top | |||
beech pilot![]() Member ![]() Posts: 36 Joined: 11/1/2018 Location: Visalia ![]() |
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![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
I can’t decipher what you are saying. Why not try modifying the code yourself a bit? | ||
^ Top | |||
beech pilot![]() Member ![]() Posts: 36 Joined: 11/1/2018 Location: Visalia ![]() |
thanks Jim for the help what you have done i will seek another avenue to get this finished, | ||
^ Top | |||
Ryan Olson![]() Veteran ![]() ![]() ![]() Posts: 170 Joined: 12/29/2006 Location: Austin, Tx ![]() |
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![]() Member ![]() Posts: 36 Joined: 11/1/2018 Location: Visalia ![]() |
100 percent what i needed . You nailed it perfectly Ryan. Obviously the pics were very straight forward thanks a ton | ||
^ Top | |||
nawaz![]() New User Posts: 2 Joined: 5/16/2016 Location: SURREY BC CANADA ![]() |
thank you |
|
|
Legend | Action | Notification | |||
Administrator
Forum Moderator |
Registered User
Unregistered User |
![]() |
Toggle e-mail notification |