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.

pitrader

Members
  • Content Count

    57
  • Joined

  • Last visited

Everything posted by pitrader

  1. pitrader

    Hi Low Txt

    I am looking for an indicator coded in TS that will allow me to click on a price bar and the high of the bar plus 1 tick will print above that bar and the low minus 1 tick will print below that bar. Does anyone know of anything like this?
  2. I have an indicator that works fine on minute charts but will not work on second charts. I have the code below. Is there some way that I can get it to work on second charts? inputs: DateOfLine(currentdate), DistFromSwing_Ticks(15), StartBarCount_Time(836), ExtendLines_Right(false), Line1_Color(blue), Line1_StartBarCount(4), Line1_EndBarCount(13), Line2_Display(true), Line2_StartBarCount(8), Line2_EndBarCount(19), Line3_Display(true), Line3_StartBarCount(15), Line3_EndBarCount(25); vars: X(0), ColorCount(0), PriDisplayValue(0), EndCount(0), TickValue(minmove/pricescale); arrays: LineSwitch[3](false), TLID_Main[3](-1), StartBarCount[3](0), EndBarCount[3](0), LineHigh[3](0), LineLow[3](999999); once begin LineSwitch[1] = true; StartBarCount[1] = calctime(StartBarCount_Time, Line1_StartBarCount * barinterval); EndBarCount[1] = calctime(StartBarCount_Time, Line1_EndBarCount * barinterval); LineSwitch[2] = Line2_Display; StartBarCount[2] = calctime(StartBarCount_Time, Line2_StartBarCount * barinterval); EndBarCount[2] = calctime(StartBarCount_Time, Line2_EndBarCount * barinterval); LineSwitch[3] = Line3_Display; StartBarCount[3] = calctime(StartBarCount_Time, Line3_StartBarCount * barinterval); EndBarCount[3] = calctime(StartBarCount_Time, Line3_EndBarCount * barinterval); if Line1_Color = red then ColorCount = 1 else ColorCount = 0; for X = 1 to 3 begin if ColorCount > 1 then ColorCount = 0; PriDisplayValue = pz_iff(ColorCount = 0, getappinfo(aiLowestDispValue), getappinfo(aiHighestDispValue)); TLID_Main[X] = tl_new(currentdate, StartBarCount[X], PriDisplayValue, currentdate, EndBarCount[X], PriDisplayValue); tl_setcolor(TLID_Main[X], pz_iff(ColorCount = 0, blue, red)); tl_setextright(TLID_Main[X], ExtendLines_Right); ColorCount += 1; end; end; if d = DateOfLine then begin for X = 1 to 2 begin if t >= StartBarCount[X - 1] then EndCount = X + 1; end; for X = 1 to EndCount begin if t >= StartBarCount[X] {and t <= EndBarCount[X]} then begin if h > LineHigh[X] then LineHigh[X] = h; if l < LineLow[X] then LineLow[X] = l; end; if LineSwitch[X] then begin if tl_getcolor(TLID_Main[X]) = blue then begin tl_setend(TLID_Main[X], d, EndBarCount[X], LineLow[X] - DistFromSwing_Ticks * TickValue); tl_setbegin(TLID_Main[X], d, StartBarCount[X], LineLow[X] - DistFromSwing_Ticks * TickValue); end else begin tl_setend(TLID_Main[X], d, EndBarCount[X], LineHigh[X] + DistFromSwing_Ticks * TickValue); tl_setbegin(TLID_Main[X], d, StartBarCount[X], LineHigh[X] + DistFromSwing_Ticks * TickValue); end; end; end; end;
  3. What would the code look like for ELD if I wanted to say "at least 1 tick higher than" Thanks Pi
  4. pitrader

    Paint Bar

    Thanks for the reply Easytrader. Much appreciated Pi
  5. pitrader

    Paint Bar

    I am hoping that someone can help me with some coding. What I need is a rather simple paint bar study that will paint a bar yellow if it's range is = > the sum of the ranges of the 2 bars that preceded it. Any help would be appreciated. Thanks Pi
  6. I have a countdown timer that was written for TS but it will not compile for MC. I have the code below if somebody can help me to get it to compile. Thanks Pi { _TimerExample4 v1.1 6 February 2012 Designed for TradeStation 9 This code is a simple bar countdown timer for minute bars. } using elsystem; vars: int TXID(0), IntrabarPersist Countdown_Text(" time"), IntrabarPersist mins(0), IntrabarPersist secs(0), IntrabarPersist mins_str(""), IntrabarPersist secs_str(""), IntrabarPersist Guess(true), Countdown_seconds(1), Timer Timer(null); //This is the Timer event. Note that we've seperated out the 'time left in bar' calculation, // and the 'display text' calculation into their own methods. And then we call them from // this event. This is good coding practice. method void Timer1_Elapsed( Object sender, TimerElapsedEventArgs args ) begin Calc_Time_Remaining(); //Calculate the amount of time remaining Display_Text(); //Display the amount of time remaining end; //Calculate the amount of time remaining in the bar // This is reasonably complex, but isn't particularly relevant to how the Timer object works // so you don't need to understand it method void Calc_Time_Remaining() begin //If its the end of a bar then set the countdown to the bar interval if BarStatus(1) = 2 then begin mins = BarInterval; secs = 0; Guess = false; //We're turning the time off and on here just to sync it correctly with the bar end Timer1.Enable = false; Timer1.Enable = true; end //This is our first guess at the bar time, before we have a bar end to sync properly. // It uses your computer clock to work out roughly how much time is left in a bar. else if Guess then begin mins = time - CurrentTime; secs = 60 - SecondsFromDateTime(ComputerDateTime); if secs = 60 then secs = 0; if secs > 0 then mins = mins - 1; end //Countdown our timer else begin secs = secs - Countdown_seconds; if secs < 0 then begin secs = 9; end; end; //Set our Countdown_Text variable to the correct string secs_str = NumToStr(secs, 0); if strlen(secs_str) = 1 then secs_str = "0" + secs_str; Countdown_Text = " " + mins_str +":" + secs_str; end; //Display our countdown text method void Display_Text() begin Text_SetString(TXID, Countdown_Text); Text_SetLocation(TXID, date, time, Close); Text_SetStyle(TXID, 0, 2); Text_SetColor(TXID, yellow); end; //This author uses 'once' to initialize objects. Other authors may use // AnalysisTechnique_Initialize, or a component dragged and dropped from the // ToolBox. All approaches are equally valid, they are just down to the // authors style. once begin //Create the Timer, set it to update every second, but don't start it yet Timer1 = new elsystem.Timer; Timer1.Interval = Countdown_seconds * 1000; Timer1.Elapsed += Timer1_Elapsed; //Create the text to display the countdown TXID = Text_New(date, time, close, Countdown_Text); end; //When the first real-time tick arrives... if GetAppInfo(aiRealTimeCalc) = 1 then begin //...start the Timer Timer1.Enable = true; //Set the amount of time left in a bar at the end of every bar if BarStatus(1) = 2 then begin Calc_Time_Remaining(); end; end; Display_Text();
  7. I have a countdown timer that was written for TS but it will not compile for MC. I have the code below if somebody can help me to get it to compile. Thanks Pi { _TimerExample4 v1.1 6 February 2012 Designed for TradeStation 9 This code is a simple bar countdown timer for minute bars. } using elsystem; vars: int TXID(0), IntrabarPersist Countdown_Text(" time"), IntrabarPersist mins(0), IntrabarPersist secs(0), IntrabarPersist mins_str(""), IntrabarPersist secs_str(""), IntrabarPersist Guess(true), Countdown_seconds(1), Timer Timer(null); //This is the Timer event. Note that we've seperated out the 'time left in bar' calculation, // and the 'display text' calculation into their own methods. And then we call them from // this event. This is good coding practice. method void Timer1_Elapsed( Object sender, TimerElapsedEventArgs args ) begin Calc_Time_Remaining(); //Calculate the amount of time remaining Display_Text(); //Display the amount of time remaining end; //Calculate the amount of time remaining in the bar // This is reasonably complex, but isn't particularly relevant to how the Timer object works // so you don't need to understand it method void Calc_Time_Remaining() begin //If its the end of a bar then set the countdown to the bar interval if BarStatus(1) = 2 then begin mins = BarInterval; secs = 0; Guess = false; //We're turning the time off and on here just to sync it correctly with the bar end Timer1.Enable = false; Timer1.Enable = true; end //This is our first guess at the bar time, before we have a bar end to sync properly. // It uses your computer clock to work out roughly how much time is left in a bar. else if Guess then begin mins = time - CurrentTime; secs = 60 - SecondsFromDateTime(ComputerDateTime); if secs = 60 then secs = 0; if secs > 0 then mins = mins - 1; end //Countdown our timer else begin secs = secs - Countdown_seconds; if secs < 0 then begin secs = 9; end; end; //Set our Countdown_Text variable to the correct string secs_str = NumToStr(secs, 0); if strlen(secs_str) = 1 then secs_str = "0" + secs_str; Countdown_Text = " " + mins_str +":" + secs_str; end; //Display our countdown text method void Display_Text() begin Text_SetString(TXID, Countdown_Text); Text_SetLocation(TXID, date, time, Close); Text_SetStyle(TXID, 0, 2); Text_SetColor(TXID, yellow); end; //This author uses 'once' to initialize objects. Other authors may use // AnalysisTechnique_Initialize, or a component dragged and dropped from the // ToolBox. All approaches are equally valid, they are just down to the // authors style. once begin //Create the Timer, set it to update every second, but don't start it yet Timer1 = new elsystem.Timer; Timer1.Interval = Countdown_seconds * 1000; Timer1.Elapsed += Timer1_Elapsed; //Create the text to display the countdown TXID = Text_New(date, time, close, Countdown_Text); end; //When the first real-time tick arrives... if GetAppInfo(aiRealTimeCalc) = 1 then begin //...start the Timer Timer1.Enable = true; //Set the amount of time left in a bar at the end of every bar if BarStatus(1) = 2 then begin Calc_Time_Remaining(); end; end; Display_Text();
  8. I have a countdown timer that was written for TS but it will not compile for MC. I have the code below if somebody can help me to get it to compile. Thanks Pi { _TimerExample4 v1.1 6 February 2012 Designed for TradeStation 9 This code is a simple bar countdown timer for minute bars. } using elsystem; vars: int TXID(0), IntrabarPersist Countdown_Text(" time"), IntrabarPersist mins(0), IntrabarPersist secs(0), IntrabarPersist mins_str(""), IntrabarPersist secs_str(""), IntrabarPersist Guess(true), Countdown_seconds(1), Timer Timer(null); //This is the Timer event. Note that we've seperated out the 'time left in bar' calculation, // and the 'display text' calculation into their own methods. And then we call them from // this event. This is good coding practice. method void Timer1_Elapsed( Object sender, TimerElapsedEventArgs args ) begin Calc_Time_Remaining(); //Calculate the amount of time remaining Display_Text(); //Display the amount of time remaining end; //Calculate the amount of time remaining in the bar // This is reasonably complex, but isn't particularly relevant to how the Timer object works // so you don't need to understand it method void Calc_Time_Remaining() begin //If its the end of a bar then set the countdown to the bar interval if BarStatus(1) = 2 then begin mins = BarInterval; secs = 0; Guess = false; //We're turning the time off and on here just to sync it correctly with the bar end Timer1.Enable = false; Timer1.Enable = true; end //This is our first guess at the bar time, before we have a bar end to sync properly. // It uses your computer clock to work out roughly how much time is left in a bar. else if Guess then begin mins = time - CurrentTime; secs = 60 - SecondsFromDateTime(ComputerDateTime); if secs = 60 then secs = 0; if secs > 0 then mins = mins - 1; end //Countdown our timer else begin secs = secs - Countdown_seconds; if secs < 0 then begin secs = 9; end; end; //Set our Countdown_Text variable to the correct string secs_str = NumToStr(secs, 0); if strlen(secs_str) = 1 then secs_str = "0" + secs_str; Countdown_Text = " " + mins_str +":" + secs_str; end; //Display our countdown text method void Display_Text() begin Text_SetString(TXID, Countdown_Text); Text_SetLocation(TXID, date, time, Close); Text_SetStyle(TXID, 0, 2); Text_SetColor(TXID, yellow); end; //This author uses 'once' to initialize objects. Other authors may use // AnalysisTechnique_Initialize, or a component dragged and dropped from the // ToolBox. All approaches are equally valid, they are just down to the // authors style. once begin //Create the Timer, set it to update every second, but don't start it yet Timer1 = new elsystem.Timer; Timer1.Interval = Countdown_seconds * 1000; Timer1.Elapsed += Timer1_Elapsed; //Create the text to display the countdown TXID = Text_New(date, time, close, Countdown_Text); end; //When the first real-time tick arrives... if GetAppInfo(aiRealTimeCalc) = 1 then begin //...start the Timer Timer1.Enable = true; //Set the amount of time left in a bar at the end of every bar if BarStatus(1) = 2 then begin Calc_Time_Remaining(); end; end; Display_Text();
  9. I don't know if this has already been asked in this forum but I will give it a shot. Does anybody know of an indicator that can calculate at what tic a bar will turn a MA. eg if the market has been falling and the MA has been going down how many up tics will it take for the MA to turn up? And have this price market by a dot. If this has already been addressed then can someone direct me to the thread. Thanx Barry
  10. pitrader

    MA Value

    How would I go about having a MA value 1 bar ago displayed in the price pane. The current value is easy but I can’t figure out how to display the value 1 bar ago. Any help would be appreciated. Thanks Pi
  11. Does anybody know where I can get a countdown timer for TS that will work on second bars to tell me when the bar will close? This would be a real handy tool to have. Thanks Pi
  12. In TS ver 9.1 there is a new feature that allows you to set the transparency of a line or tool to a user defined %. Is there some way that the transparency % can be coded into the indicator so I am not constantly doing it manually? Thanks Pi
  13. How would I go about hiding the inputs in the code below. I know that you have to turn them into variables and the variables into vars but I keep screwing up. inputs: Extension1_Percent(200), Extension2_Percent(250), ExtensionColor(Getbackgroundcolor), ExtensionColorMove(darkblue), ShowAverages(true), LineLength_Bars(4), SlowAvgPrice(close), SlowAvgLength(10), SlowAvgDisplace(3), FastAvgPrice(close), FastAvgLength(5); variables: Debug(false), BarsBack_Pt1(4), StartSwitch(false), SecondSwitch(false), ThirdSwitch(false), OriginalHigh(0), Counter(0), Projection1(0), Projection2(0), SlowAverage(0), FastAverage(0), TLForeCast(0), HighBar(99999999), TL(-1); Thanks Pi
  14. What is the code for line thickness. I know that in order to make a tl dotted it would be TL_SetStyle(TL, tool_dotted); but I would like to make the thickness double what it is instead of dotted. Thanks Pi
  15. I have some code below which utilizes a displaced slowMA. How would I replace this displaced slowMA with a displaced low band of a keltner channel? This one is taxing my brain!! Thanks Pi inputs: Extension1_Percent(200), Extension2_Percent(250), ExtensionColor(red), ExtensionColorMove(darkred), ShowExtensionHistory(true), LineLength_Bars(4), SlowAvgPrice(close), SlowAvgLength(10), SlowAvgDisplace(3), FastAvgPrice(close), FastAvgLength(5); variables: Debug(false), StartSwitch(false), SecondSwitch(false), ThirdSwitch(false), OriginalLow(0), Counter(0), Projection1(0), Projection2(0), SlowAverage(0), FastAverage(0), TLForeCast(0), LowBar(99999999), TL(-1); //================================== // Calcluation Module //================================== Once TL = TL_New(Date,Time,0,Date,Time,0); //Initialized TrendLine SlowAverage = WAverage(SlowAvgPrice, SlowAvgLength); FastAverage = WAverage(FastAvgPrice, FastAvgLength); Counter += 1; if date <> date[1] then begin //reset conditions on start of day StartSwitch = false; SecondSwitch = false; ThirdSwitch = false; end; if SlowAvgDisplace >= 0 or CurrentBar > AbsValue(SlowAvgDisplace) then begin
  16. I have a project that I need help coding. I have 2 MA’s one slow and one fast. The slow MA is displaced back 3 periods with a TL extension the code for it is below. Let’s assume that the market has been falling and the fast MA [1] is < the slow MA [1] and the market makes a low. Now the market is beginning to go up, the fast MA turns up and the fast MA [1] is now > the slow MA’s extension [1]. What I need is to have 2 horizontal lines appear on the chart when the fast MA crosses (on a closing basis) the TL extension of the slow MA. Measuring the distance from the low that the market just made to the intersection of the fast MA and the TL extension of the slow MA and project that distance upwards from the intersection 200% and the other line at 250%. Right now all I need is this in one direction I can reverse the code once I see it and make any alterations necessary. I will try to post a picture of it to clarify. This will help me immensely. Thanks loads Pi inputs: Price( (high+low)/2), Length( 20), Displace( 3) ; variables: AvgWtd( 0 ) , TL (-1); if Displace >= 0 or CurrentBar > AbsValue( Displace ) then begin AvgWtd = WAverage( Price, Length ) ; Plot1[Displace]( AvgWtd, "AvgWtd" ) ; Once TL=TL_New(Date,Time,0,Date,Time,0); TL_SetEnd(TL,Date[Displace+0],Time[Displace+0],Plot1 [Displace+0] ); TL_SetBegin(TL,Date[Displace+1],Time[Displace+1],Plot1[Displace+1]); TL_SetExtRight(TL,true) ; TL_SetStyle(TL, tool_dotted); TL_SetColor(TL, color.white); end; Noname1.zip
  17. pitrader

    Sub Chart

    Is there some way that I can hide a sub chart (Data 2) in TS? I know that you can do this in MC but I cannot see the feature in TS. I shrank it down as much as possible but when you have 4 sub charts it can start to take up some much needed room. Thanks Pi
  18. pitrader

    Time Lines

    Thanks again BH I'll give it a try. Pi
  19. pitrader

    Time Lines

    Is it possible to create a indicator that just plots vertical lines of different styles and times that are user defined? ( A red dotted line at 10:34 and a solid blue line at 11:28 etc.) ?
  20. Worked like a charm.. Thanks Again Pi
  21. In the code below the jthma is displaced back 2 periods. How would I modify the code to displace the SMA back 2 periods as well? If I place a -2 in the inputs a alert comes that says "Cannot reference historical data into the future." Input: jthma_Length (25), SMA_Length (7), jthma_Value_Displacement (2); Value1 = jthma( Close, jthma_Length ) ; // calc a 25-period HMA Value2 = Average( Value1[jthma_Value_Displacement], SMA_Length ) ; // Calc average of HMA displaced back 2 periods Plot1(Value2, "jthma");
  22. pitrader

    New MA

    I am wondering whether it would be possible to create a MA from another MA. What I need is a simple MA created from a Hull MA that has been displaced back 3 periods. Any help would be appreciated. Thanks Pi
  23. I have a project for any TS code writers out there with a few minutes to spare. What I want is high-low[1] +high-low[2]/2 of a 10min bar. This range will be placed on a 1min chart with the high of the range projected from the lowest low of the current 10min bar and the low of the range projected from the highest high of the current 10min bar. This will update realtime as a new high or low is made and will also have a history going back 1 10min bar. This way I will have the current range and the range of the previous 10mins showing on my 1min chart. This would really help me out so I am not constantly doing it manually. Thanks Guys!!! Pi
  24. pitrader

    Paint Bar

    Hey Bh! That is what I needed thank you for your time is is appreciated. Pi
  25. pitrader

    Paint Bar

    Thank you BH that solves the verifying problem. However I will still need to have the Hull avg displaced. Does this throw a monkey wrench into the works? Thankx Pi
×
×
  • Create New...

Important Information

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