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

Personal Information

  • First Name
    TradersLaboratory.com
  • Last Name
    User
  • Country
    Canada

Trading Information

  • Vendor
    No
  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
×
×
  • Create New...

Important Information

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