[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Single alerts within a bar in realtime



PureBytes Links

Trading Reference Links

I compiled a 32 bit version of the DLL and attached it. I presume that you
could use the same code below with the 32 bit DLL in TS2000i, but I don't
have that version of TS so I can't test it. Once again, use at your own
risk!

Patrick White
----- Original Message -----
From: "Patrick White" <simgenie@xxxxxxxxx>
To: "Omega List" <omega-list@xxxxxxxxxx>
Sent: Thursday, July 12, 2001 11:43 AM
Subject: Re: Single alerts within a bar in realtime


I have had this same problem in the past. The issue is that internally, TS
doesn't remember variable values with any more granularity than the current
bar (doesn't remember what happened on the last tick of the current bar). I
made a simple DLL and TS function to get around this problem. I am attaching
it to this post. This is for 16 bit TS4. You must copy the DoOnce16.DLL file
into your \Omega\Prog\ directory.

{--------------------}
{Function DoOnce}
{When DoOnce returns True, it means no Alert has occurred on the current bar
yet}
Inputs: Symbol(NumericSimple);

 DefineDLLFunc:"DoOnce16.DLL",LONG,
  "DoEvent",Long,{Symbol Number}
  LONG;{Bar Time}

 Value1 = DoEvent(Symbol, Time);
 if Value1 = 1 Then DoOnce = True Else DoOnce = False;
{End of Function DoOnce}
{--------------------}


To test the function I created a simple Indicator:
{-----------------------}
{Indicator AlertOnce}
Inputs: SymNum(1100);   {Add this input to your existing Indicator/System
Code}

 {Prep the DoOnce Function}
 If CurrentBar = 1 then Condition1 = DoOnce(SymNum);

 if LastBarOnChart = True then begin
     {Some Simple Condition is met}
      If Close > Open Then Begin
          if DoOnce(SymNum) Then Alert = True;
      end;
 end;

if 1 = 0 then Plot1(0,"Bogus");     {Every indicator needs a plot statement}
{End Indicator AlertOnce}
{----------------------------}


You can use the DoOnce function on multiple graphs, just change the Symbol #
to a unique number on each chart where you call this function. The DoOnce
Function is designed to return True the first time a condition is met on the
current bar and false every time thereafter on the current bar. Make sure to
enable your indicators to update on every tick.

Enjoy!

I take no responsibility for how you use any of this material. It has not
been designed for any specific purpose other than to illustrate how to make
an alert only do once per bar. Use at your own risk! This program contains
no warrantees or guarantees of any kind. I disclaim any and all losses you
might incur through the use of this program in actual trading.

Patrick White

Copyright 2001 Patrick White.





begin 666 DOONCE32.DLL
M35H*``(````$``\`__\``, `````````0 ``````````````````````````
M````````````````````@ ```+0)NA `#A_-(;@!3,TAD)!4:&ES(&ES(&$@
M5VEN,S(@<')O9W)A;2X-"B0```````````````````````````!010``3 $$
M`#DP`````````````. `#B,+`0(TP0H````"``"<`0``(!(````0````( ``
M``! ```0`````@``! `````````$``````````!0````! ````````(`````
M`! ``" `````$ ``$ ```````! ```! ,P``1P`````P```R`P``````````
M`````````````````````````$ ``' `````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````"YT97AT`" @P0H````0````# ````0`````````
M`````````" ``& N9&%T80`@()P#````( ````(````0````````````````
M``! ``# +FQI;FL`(""'`P```# ````$````$@``````````````````0 ``
MP"YR;&]C`" @< ````! `````@```!8``````````````````$ ``$(`````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````,/#=P4KPG@!P[()
MMH!FB560PZD`____=0;#"N1U`<.R!NOHA<!X^,-0B]"8.\)8=>[#J0" __]U
MYL.I``#__W7>PX7;= '#L@xxx,/V19& =0'#@'61@(M-E./V@$V10%K_X>B!
M! ``Z&T$````````<&)5B^Q35E>#[%PQ]E965E965E;H) H``,,`````@SV0
M(D ```^%A@```+N4(D `N (```#H. @``&H`:@%J!&@```@!:@"[E") `.B<
M!0``NP@xx "X`@```.@x" ``:@!J`6H$: ``" %J`+L((T `Z'8%``#'!9 B
M0 `!````BP60(D `BQV4(D `BU4(B12#BP60(D `BQT((T `BU4,B12#QT6(
M`0```.GK````BP60(D `B85\____Q\8!````Z54```"+QHL=E") `(L$@SM%
M" ^%/P```(O&BQT((T `BP2#.T4,#X41````QT6(`````.DK````Z1H```"+
MQHL=""- `(M5#(D4@\=%B $```#I# ```/_&B\8[A7S___]^H3DUD") ``^-
M:0```/\%D") `&H`BP60(D `4&H$:( `" %J`+N4(D `Z&8%``!J`(L%D") 
M`%!J!&B ``@!:@"[""- `.A*!0``BP60(D `BQV4(D `BU4(B12#BP60(D `
MBQT((T `BU4,B12#QT6(`0```(M%B(UE]%]>6UW"" ````````!5B^Q35E>[
M`"! `&8N]P5$%D `! `/A9@```#H'P$``,=#8 $```"-@^0!``!0_Q4,,4 `
M@^Q$QP0D1 ```,=$)"P`````5/\5!#% `+@*````]T0D+ $```!T!0^W1"0P
M@\1$B4-6_Q7T,$ `Z)X```")0TS_%?@P0 ")0TAJ`/\5`#% `(E#7.CY````
MZ*H```"X_P```'(-4^B6````6_]+$/]+&%]>6UU0_Q7L,$ `PX-]# %U/^B!
M````C8/D`0``4/\5##% `/\5]#! `.@x````B4-,_Q7X,$ `B4-(BT4(B4-<
MZ)H```#H2P```'(19O]#6HM%#(E#8%/H,@```%L/MT-:7UY;7<(,`( X(G4-
M0( X(G7Z0( X('3ZPX X('0(0( X('?Z<@9 @#@@=/K#Z0C]___#P_C#_8M+
M& -+((US* /Q3HM[' /[`_E/\Z2Y& ```(V[CP(``/.D9L=#6@``QX/D`0``
ME ````&;? (```&;A (```&;C (``/S#9L=#4 ``BJ/H`0``BH/L`0``9HE#
M4HN#] $``*@!=0JH`G0K9K@`!.LA9HN3\ $``&:!^K8#9KB `'0/9H'Z5P1F
MN `!= 1FN `"9@x#4.@&````Z&X```##@^PD5/S_%0@xx #&0U0#9O=#4( #
M=1]F]T-0``1T2F:#/"0`=4.*1"0@/ -R.SP%=AJP!>L6BT0D&#V"`0``=B@]
M2@(``+ %<P*P!(A#5#P%<A:X`0```%,/HEOWP@``@ !T!6:#2U! @\0DPU14
M:!D``@!J`.@x````2$%21%=!4D5<1$530U))4%1)3TY<4WES=&5M7$9L;V%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/HM5N#M7_ ^,D@```(A#
M!(L/*\I^'X![!B!U&5)3BT,,`P.+V(/K!#/VAS/H7 (``.+R6UK_<PC_<PP/
MMDL',_:)%XM$,QPK1#,80$ET&8/&#(E$,Q2+1#,<*T0S&$#W9#,427?I<BV)
M0PCW8Q1R)8O(AT,,B]"+`^@Y````<A>#Q B)`X!+! 0^BW6P/HM]M#[_9:RP
M"8]##(]#"&:ZL D^BW6P/HM]M#[_=:SI0_W__W0"M/_#.\IT%%!14FI 45#_
M%1@xx `+P'0$6EE:PXM$) 3HZ?S__W),4%97BTPD#(M4)!#\BW0D%(OX.\IR
M!HO*,]+K`BO14<'I`O.E68/A`_.DB\HSP-'I\V:K@x$`\ZJ+1"04Z!P!``!?
M7EIR!HO"@\0,PUI96L/H" ```'(!P^F]_/__5E>*8P3VQ 1T3/;$`75#@'L&
M('(*BTL(BSOH.P```*@!=0ZH`G4>]L0@=1GVQ!!T%(![!B!T'S/ BU,,BSOH
MZ_W__^L1,\"'`U/HL0```%MR!8!C!/KX7U[#4%%7B]%*P>("`]>+S^@2````
M7UE8,_:'-^C=````@\<$XO+#4U%25E>+\8OZB]X#W]'K]\,"````= .#PP*+
M&SOW=RXY'G8)._)S!8/&!.OS.Q]V"3OY=@x#[P3K\SOW=]YT!HL&AP>)!H/&
M!(/O!.O..\]S"5*+U^BF____6COR<PE1B\[HF?___UE?7EI96\-7_#/ B\B+
M^]'I\V:K@x$`\ZI?PU#_%10Q0 "%P'4!P[ S^</'0WP`````C4,RB8. ````
MP^,64%%1:@#_%3PQ0 !9A<!T#HO0B_A8PS/2OS(@0 ##N0````"+T;\R($ `
M6+@'````^<-045*%]GX'5O\50#% `%I96/C#@>;___]_= 2+3OS#B\Z^,B! 
M`,.!Y____W]T!(M7_,.+U[\R($ `PU>!YO___W_HA?___W(6_%91P>D"\Z59
M@^$#\Z1>Z*/___]?P^B<____7_G#^,-;C4,%4%.+6P&)791F@xxxxxx#````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````````````````````$````D (``.@```"4`@``( ```'P#````````
M0 `(`0````````````````0`````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````! ``@!````````````````! ``
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````_____P``````!@``( ````````#_____``````$`````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````9# `````````````5#$``-PP``!P, ``````
M``````!B,0``Z# ``,0P`````````````' Q```\,0``U# `````````````
M?C$``$PQ`````````````````````````````((R``"2,@```````(HQ``"8
M,0``IC$``+HQ``#,,0``YC$``/8Q```*,@``'#(``"PR```\,@``2C(``%@x
M``!V,@``H#(``+ R``# ,@``TC(``.(R```F,P```````.HR```",P``$C,`
M``````!H,@```````((R``"2,@```````(HQ``"8,0``IC$``+HQ``#,,0``
MYC$``/8Q```*,@``'#(``"PR```\,@``2C(``%@x``!V,@``H#(``+ R``# 
M,@``TC(``.(R```F,P```````.HR```",P``$C,```````!H,@```````$%$
M5D%023,R+D1,3 ``2T523D5,,S(N1$Q,``!/3$5!550S,BY$3$P``%5315(S
M,BY$3$P`````0VQO<V5(86YD;&4```!%>&ET4')O8V5S<P```$9L=7-H1FEL
M94)U9F9E<G,`````1V5T0V]M;6%N9$QI;F5!````1V5T16YV:7)O;FUE;G13
M=')I;F=S00````!'971,87-T17)R;W(`````1V5T36]D=6QE2&%N9&QE00``
M``!'9713=&%R='5P26YF;T$```!'9713>7-T96U);F9O````1V5T5F5R<VEO
M;D5X00```$=L;V)A;$%L;&]C````1VQO8F%L1G)E90````!';&]B86Q294%L
M;&]C````365S<V%G94)E97 ```!296%D1FEL90````!296=/<&5N2V5Y17A!
M````4F5G0VQO<V5+97D```!3971%;F1/9D9I;&4`````4V5T17)R;W)-;V1E
M`````%-E=$9I;&50;VEN=&5R`````%-E=$QA<W1%<G)O<@````!3;&5E< ``
M`%-Y<T%L;&]C4W1R:6YG0GET94QE;@```%-Y<T9R9653=')I;F<```!3>7-3
M=')I;F=">71E3&5N`````%=R:71E1FEL90`````````````````````````H
M0S$``````'(S```!`````0````$```!H,P``;#,``' S``!S$ ``?S,`````
M1$]/3D-%,S(N1$Q,`$1/159%3E0`````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````````0``!P````D3"=,+DPPS#?,.HP]##Z, 8Q##$D,3TQ43%V,9HQ
MIC&N,;TQRC'9,>0QZC'V,?PQ4#)I,HDRES*B,N<RSC+M,OLRMC3-- @T9S5_
M-2<RZC0Y-<8T+S)(-GPX\SD:.D\Z+#HY.F<Z>SH`````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
8````````````````````````````````
`
end