Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

chrisleonard

Members
  • Content Count

    86
  • Joined

  • Last visited

Everything posted by chrisleonard

  1. hmm i think i thought of a way using numto string how could i change the ATR value using the decimals value So could i put something like this to change the atr decimal places to the same as the price? ATR2 = numtostr(ATR,decimals);
  2. hi im trying to turn the Average true range to show the movement in the market for the stock im looking at!! im having trouble as the decimals for price are always different yet the ATR always seems to be 4 decimal places.. The code im using is!! variables: Decimals( Log(PriceScale) / Log(10) ), decimal(0); if decimals = 2 then decimal = 10; if decimals = 3 then decimal = 100; if decimals = 4 then decimal = 1000; if decimals = 5 then decimal = 10000; ID = Text_New(D,T,L-Range, "movement: " + numtostr(ATR*decimal,0) ); this gives me a value which is fine for GBPUSD but then it starts to mess up on say @cl.c Anyone got any ideas how to maybe change my code to do what i need it to? I think im nearly there!! Thanks
  3. Hi there, all of you help has been invalueble seriously mate, thank you. I typed this in then begin cti = 1; Plot4(low,"test",green); ID = Text_New(D,T,L-range, "S:"); end else begin noplot(4); Value1 = Text_Delete(ID); end; but this never plots any text now, the rest is fine, any ideas?
  4. hmm maybe some quick syntax help here please as when i add this to another alert with text it causes problems! if (cti = 0 and Value1 > Value1[1] and Value2 > Value2[1] and barColor = barColor[1]) or (cti = 0 and Value1 > Value1[1] and Value2 > Value2[1] and barColorpl = barColorpl[1]) then begin cti = 1; Plot4(low,"test",green); ID = Text_New(D,T,L-range, "S:"); < ------------ how do i get rid of this if the plot is removed??? end else noplot(4); end;
  5. Hi Blu-Ray that seems to do the trick wow thanks so much for that!!
  6. is there something i can do? Maybe some code to say if these conditions change before the candle closes to remove the plot?
  7. Hi I have writtent his code to plot a dot under the right conditions. This usally works fine but if the conditions change on that same plot then it reverts to its default colour! How can i get around this happening so that it removes the plot or something if conditions change! here is the code if cti= 0 and Value1 > Value1[1] and Value2 > Value2[1] and barColor = barColor[1] then begin SetPlotColor( 4, green ) ; Plot4(low,"testy"); but if it plot a green dot and the price goes the other way on that candle it just removes the colour and keeps a pink dot!! Thanks
  8. Thanks very much Charlton you have been a great amount of help!!
  9. look a little harder then because im more than thankfull!
  10. Hello. 2 things. Is there a clever way to get the the text to stay just below the bottom of the cadle as the range sometimes puts it really far away i only want like a small gap at the bottom but it must be the same no matter what im trading! Second because the dicimal place changes with most instruments is there another way to change the decimals each time? when im trading forex its 6 decimals but when im trading oil its only 2 so i have to either make an input or change code!! here is what i use now ID = Text_New(D,T,H+Range, "Stop: " + numtostr(ATR*decimal+5,0) ); Value7 = Text_SetColor(ID ,Red); Value8 = Text_SetStyle(ID,2,0);
  11. Hi Im trying to make an indicator that closts info on the char such as a DOT but also want to change that bars colour! I have tried creating a paintbar to do this but cant plot dots i dont think! is there anyway to change the colour of a candle in and indicator then? or how do i create and indicator which can colour a paintbar as well as plotting info? Thanks
  12. wow thats some really informative help there buddy and has helped me greatly! Now im very intregued by how you displayed the value there using numtostr is there a way i could turn a value like 0.00650 into 65?? Thanks chris
  13. sorry i thought it was ok but the text does not appear on my chart if i put -3 after Low this works fine but the text is too clost to the candle! ID = Text_New(D,T,L, "test: " + numtostr(H,3) ); Value7 = Text_SetColor(ID ,yellow); Value8 = Text_SetStyle(ID,0,0); this displays no text ID = Text_New(D,T,L-3, "test: " + numtostr(H,3) ); Value7 = Text_SetColor(ID ,yellow); Value8 = Text_SetStyle(ID,0,0); sorry to be a pain!
  14. hi there, Yes sorry i edited it as i changed the way i did it! Thanks so much for your help that worked perfectly!! Thank you Chris
  15. Hi I have added this code to add text to my charts at a specific point which works grat but i want to distance the text a specific distance from every candle it plots too! textval = Text_New(D,T,L-Range*0.5, "Stop:" ); textval = Text_New(D,T,L-Range*1.3, "Target:" ); Obviously the rage is different everytime so all distances are different I tried textval = Text_New(D,T,L-0.5, "Stop:" ); textval = Text_New(D,T,L-1.3, "Target:" ); which did not work how can i set a distance without haveing to use Range*0.5
  16. yes it was the plot format Thanks
  17. hmmmmm ok this is my new squeeze, FastVal1 = ProSqFunc(price, 8, poles); SlowVal1 = ProSqFunc(price, 21, poles); Diff1 = FastVal1 - SlowVal1; FastVal2 = ProSqFunc(price, 13, poles); SlowVal2 = ProSqFunc(price, 34, poles); Diff2 = FastVal2 - SlowVal2; FastVal3 = ProSqFunc(price, 21, poles); SlowVal3 = ProSqFunc(price, 55, poles); Diff3 = FastVal3 - SlowVal3; FastVal4 = ProSqFunc(price, 34, poles); SlowVal4 = ProSqFunc(price, 89, poles); Diff4 = FastVal4 - SlowVal4; AvgDiff = (Diff1+Diff2+Diff3+Diff4)/4; if AvgDiff > 0 then if AvgDiff > AvgDiff[1] then begin ALERT("BUYCOLOR1"); end; I thought this would take out the majority of problems but it is still alerting on reds!!! here is an egsample of it being wrong!!
  18. yes thats a nice way to troubleshoot! but for some reason no matter what i do i get the same results.... yes it fires mostly correct one but still some wrong!!!
  19. i hope this is what you meant !!! Thanks Chris
  20. Hi Sorry i didn try to explain properly and i did do what you said. Seriously i have got so fat since the Text on Chart post and you have really helped! I have also written out my logic step by step which has got me this far but im still haveing this problem!! The yellow dot in the poicture i did using paintbrush to show where i was getting an alert in the wrong place!! The problem is it fires in all the right places but still fires sometimes where i have pointed out with the yello dot!! Here is the code i have written into the original squeeze code from here!! Inputs: Price(Close), price2(close),Price3(H/3+L/3+C/3), Length(20), Length2(13), Length3(21), Length4(9), Style(1), nK(1.5), nBB(2), AlertLine( 1 ), BuyColor1(blue), BuyColor2(darkblue), SellColor1(red), SellColor2(darkred), NormalColor(Red),AlertColor(Blue), CounterTrend(true); vars:FastVal1(0), SlowVal1(0), Diff1(0), FastVal2(0), SlowVal2(0), Diff2(0), FastVal3(0), SlowVal3(0), Diff3(0), FastVal4(0), SlowVal4(0), Diff4(0), AvgDiff(0), AvgDif(0), poles(4), CCIValue(0),DownCT(0),UpCT(0),SDev(0),ATR(0),LHMul t(0),Denom(0),BBS_Ind(0); if Style = 0 then begin {Zero Line - BB Squeeze} if ( barnumber=1 ) then Begin If minmove <> 0 then LHMult = pricescale/minmove; end; {-- Calculate BB Squeeze ----------------------} ATR = AvgTrueRange(Length); SDev = StandardDev(Price, Length, 1); Denom = (nK*ATR); If Denom <> 0 then BBS_Ind = (nBB * SDev) /Denom; If BBS_Ind < Alertline then SetPlotColor(1, NormalColor) else SetPlotColor(1, AlertColor); {-- Plot Index & Alert Line -------------------------} Plot1(0, "Squeeze"); end; ------------------------- this is where i made changes!!!-------------------------------------------- if Style = 1 then begin {Zero Line - Gauss filter} value1 = Gauss(Price3,Length3,3); if (Value1) > (Value1[1]) then BEGIN SetPlotColor(1, BuyColor1); ALERT("BUYCOLOR1"); <-----------------------------------------here END; if (Value1) < (Value1[1]) then BEGIN SetPlotColor(1, SellColor1); ALERT("BUYCOLOR2"); < ----------------------------------------here END; //SetPlotWidth(1,7); Plot1(0, "Squeeze"); end; ------------------------------------------------------------------------------------------------------------------- {Histogram} FastVal1 = Gauss(price, 8, poles); SlowVal1 = Gauss(price, 21, poles); Diff1 = FastVal1 - SlowVal1; FastVal2 = Gauss(price, 13, poles); SlowVal2 = Gauss(price, 34, poles); Diff2 = FastVal2 - SlowVal2; FastVal3 = Gauss(price, 21, poles); SlowVal3 = Gauss(price, 55, poles); Diff3 = FastVal3 - SlowVal3; FastVal4 = Gauss(price, 34, poles); SlowVal4 = Gauss(price, 89, poles); Diff4 = FastVal4 - SlowVal4; AvgDiff = (Diff1+Diff2+Diff3+Diff4)/4; plot2(AvgDiff,"DiffHisto") ; //setplotwidth(2,7); if AvgDiff > 0 then if AvgDiff > AvgDiff[1] then setplotcolor(2,BuyColor1) else setplotcolor(2,BuyColor2) ; if AvgDiff < 0 then if AvgDiff < AvgDiff[1] then setplotcolor(2,SellColor1) else setplotcolor(2,SellColor2); {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++} { Counter Trend Mode} if CounterTrend = true then begin CCiValue = CCI(13); Condition1 = ccivalue[1] > 50; Condition2 = CCivalue < 50; Condition3 = CCivalue[1] < 100; Condition4 = CCiValue > 100; Condition5 = AvgDiff > 0; Condition6 = AvgDiff[1] > 0; Condition7 = AvgDiff[2] > 0; Condition8 = ccivalue < 100; if Condition1 and Condition2 and Condition5 and condition6 and condition7 then begin setplotcolor(2,SellColor2); DownCT = 1; end; if DownCT = 1 and AvgDiff < 0 then DownCT =0; if DownCT = 1 and Condition8 and Condition5 then setplotcolor(2,SellColor2); if DownCT = 1 and Condition3 and Condition4 then begin setplotcolor(2,BuyColor1); DownCT = 0; end; Condition11 = ccivalue[1] < -50; Condition12 = CCivalue > -50; Condition13 = CCivalue[1] >- 100; Condition14 = CCiValue < -100; Condition15 = AvgDiff < 0; Condition16 = AvgDiff[1] < 0; Condition17 = AvgDiff[2] < 0; Condition18 = ccivalue >-100; if Condition11 and Condition12 and Condition15 and condition16 and condition17 then begin setplotcolor(2,BuyColor2) ; UpCT = 1; end; if UpCT = 1 and AvgDiff > 0 then UpCT =0; if UpCT = 1 and Condition18 and Condition15 then setplotcolor(2,BuyColor2) ; if UpCT = 1 and Condition13 and Condition14 then begin setplotcolor(2,SellColor1); UpCT = 0; end; end;
  21. Hi Guys :crap: I am modifying the sqeeze to alert me when its on buycolour 1 and buycolour2 here is the squeeze im using from here!! Inputs: Price(Close), price2(close),Price3(H/3+L/3+C/3), Length(20), Length2(13), Length3(21), Length4(9), Style(1), nK(1.5), nBB(2), AlertLine( 1 ), BuyColor1(blue), BuyColor2(darkblue), SellColor1(red), SellColor2(darkred), NormalColor(Red),AlertColor(Blue), CounterTrend(true); vars:FastVal1(0), SlowVal1(0), Diff1(0), FastVal2(0), SlowVal2(0), Diff2(0), FastVal3(0), SlowVal3(0), Diff3(0), FastVal4(0), SlowVal4(0), Diff4(0), AvgDiff(0), AvgDif(0), poles(4), CCIValue(0),DownCT(0),UpCT(0),SDev(0),ATR(0),LHMul t(0),Denom(0),BBS_Ind(0); if Style = 0 then begin {Zero Line - BB Squeeze} if ( barnumber=1 ) then Begin If minmove <> 0 then LHMult = pricescale/minmove; end; {-- Calculate BB Squeeze ----------------------} ATR = AvgTrueRange(Length); SDev = StandardDev(Price, Length, 1); Denom = (nK*ATR); If Denom <> 0 then BBS_Ind = (nBB * SDev) /Denom; If BBS_Ind < Alertline then SetPlotColor(1, NormalColor) else SetPlotColor(1, AlertColor); {-- Plot Index & Alert Line -------------------------} Plot1(0, "Squeeze"); end; if Style = 1 then begin {Zero Line - Gauss filter} value1 = Gauss(Price3,Length3,3); if (Value1) > (Value1[1]) then SetPlotColor(1, BuyColor1); if (Value1) < (Value1[1]) then SetPlotColor(1, SellColor1); //SetPlotWidth(1,7); Plot1(0, "Squeeze"); end; {Histogram} FastVal1 = Gauss(price, 8, poles); SlowVal1 = Gauss(price, 21, poles); Diff1 = FastVal1 - SlowVal1; FastVal2 = Gauss(price, 13, poles); SlowVal2 = Gauss(price, 34, poles); Diff2 = FastVal2 - SlowVal2; FastVal3 = Gauss(price, 21, poles); SlowVal3 = Gauss(price, 55, poles); Diff3 = FastVal3 - SlowVal3; FastVal4 = Gauss(price, 34, poles); SlowVal4 = Gauss(price, 89, poles); Diff4 = FastVal4 - SlowVal4; AvgDiff = (Diff1+Diff2+Diff3+Diff4)/4; plot2(AvgDiff,"DiffHisto") ; //setplotwidth(2,7); if AvgDiff > 0 then if AvgDiff > AvgDiff[1] then setplotcolor(2,BuyColor1) else setplotcolor(2,BuyColor2) ; if AvgDiff < 0 then if AvgDiff < AvgDiff[1] then setplotcolor(2,SellColor1) else setplotcolor(2,SellColor2); {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++} { Counter Trend Mode} if CounterTrend = true then begin CCiValue = CCI(13); Condition1 = ccivalue[1] > 50; Condition2 = CCivalue < 50; Condition3 = CCivalue[1] < 100; Condition4 = CCiValue > 100; Condition5 = AvgDiff > 0; Condition6 = AvgDiff[1] > 0; Condition7 = AvgDiff[2] > 0; Condition8 = ccivalue < 100; if Condition1 and Condition2 and Condition5 and condition6 and condition7 then begin setplotcolor(2,SellColor2); DownCT = 1; end; if DownCT = 1 and AvgDiff < 0 then DownCT =0; if DownCT = 1 and Condition8 and Condition5 then setplotcolor(2,SellColor2); if DownCT = 1 and Condition3 and Condition4 then begin setplotcolor(2,BuyColor1); DownCT = 0; end; Condition11 = ccivalue[1] < -50; Condition12 = CCivalue > -50; Condition13 = CCivalue[1] >- 100; Condition14 = CCiValue < -100; Condition15 = AvgDiff < 0; Condition16 = AvgDiff[1] < 0; Condition17 = AvgDiff[2] < 0; Condition18 = ccivalue >-100; if Condition11 and Condition12 and Condition15 and condition16 and condition17 then begin setplotcolor(2,BuyColor2) ; UpCT = 1; end; if UpCT = 1 and AvgDiff > 0 then UpCT =0; if UpCT = 1 and Condition18 and Condition15 then setplotcolor(2,BuyColor2) ; if UpCT = 1 and Condition13 and Condition14 then begin setplotcolor(2,SellColor1); UpCT = 0; end; end; I have added this into the squeeze if Style = 1 then begin {Zero Line - Gauss filter} value1 = Gauss(Price3,Length3,3); if (Value1) > (Value1[1]) then BEGIN SetPlotColor(1, BuyColor1); ALERT("BUYCOLOR1"); END; if (Value1) < (Value1[1]) then BEGIN SetPlotColor(1, SellColor1); ALERT("BUYCOLOR2"); END; //SetPlotWidth(1,7); Plot1(0, "Squeeze"); end; but i still get alerts when it fires red sometimes, there must be a way to get this only to fire if the histogram is BUYCOLOR1 or BUYCOLOR2. Im going round in circles Heres and example of where it fired where it should not.. There is a yellow dot where it fired! Its also done it on red on the downside... thanks for any help, i have tried to be as specific as i can in the problem im having! Thanks f
  22. soz basically im trying to put a DOT below or above a candle I have read this is done using a showme study which may work I tried just a stadard plot this just ploted a line from each candle! if Value1 > Value1[1] and barColor <> barColor[1] then begin Plot7(Low,"long",YELLOW); Plot7[1](Low[1],"long",YELLOW); end; king of like this http://www.traderslaboratory.com/forums/f46/better-trin-indicator-5162.html Thanks could you point me in the right direction please?
  23. maybe putting a coloured dot above or below the candle will work https://www.tradestation.com/Discussions/Topic.aspx?Topic_ID=8966 Any ideas on how to do this? Thanks Chris
  24. Hello again I have come quite far with this text on chart stuff but would like some help please! I have put together some code which is now putting text on the chart away from the cadle but still looks wrong! I need a way to point or make is clear what candle its pointing to !! im using this code OffsetBottom = OffsetBottom+OffsetInput; ID = Text_New(D,T,L-OffsetBottom, "LONG"); Value2 = Text_SetColor(ID ,yellow); Value3 = Text_SetStyle(ID,1,2); This plots the word LONG near the cadle but its not clear which one! Is there an easier way or am i doing it wrong? Thanks Chris
  25. i promise i did forget my details, im no lyer im forgetfull and sometime lazy which is my main prob i had my pc on autologon for months then deleted forms and cookies and passwords. At the time i needed an answer and just though re-sign up is easier!! I have been coding for years on websites and had no trouble really but sometimes i feel like easy language could make my nose bleed. I am finding it easier now and will be posting up all my code soon, my main problem is i work from 4 pc's and a laptop so i ask these questions which are in my head and then the PC with Tradestation is not with me or i have emailed my self a snipet of code. This site is the best site on the net for all of this but i just really find the tradestation manuals a nightmare sometimes to comprehend. thanks again for all the help!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.