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

[amibroker] Re: alertif exec - simultaneous trading systems / alerts



PureBytes Links

Trading Reference Links

The .vbs command would be 

WScript.Sleep(1000)

Where 1000 is in milliseconds or in this case 1 second.


--- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxxx> wrote:
> You are probably correct, but I don't know how to do that.
> 
> Suggestions gladly accepted.
> --
> Terry
> 
> | -----Original Message-----
> | From: amibroker@xxxxxxxxxxxxxxx 
[mailto:amibroker@xxxxxxxxxxxxxxx] On
> | Behalf Of Fred
> | Sent: Thursday, July 14, 2005 10:49
> | To: amibroker@xxxxxxxxxxxxxxx
> | Subject: [amibroker] Re: alertif exec - simultaneous trading 
systems /
> | alerts
> | 
> | One comment on the wait function ...
> | 
> | As written I would think this would max the CPU usage while in
> | effect ...
> | 
> | You might want to instead consider an imbedded or inline vbs sleep
> | command which will not use the CPU.
> | 
> | --- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxxx> wrote:
> | > Robert,
> | >
> | >
> | >
> | > This will take some coding on your part since only you know what
> | you
> | > want to do with arbitrating the various rules.
> | >
> | >
> | >
> | > You would replace your AlertIF statement in each of your 9 
charts
> | with
> | > code like this:
> | >
> | > If (Buy) StaticVarSetText("exec_1","script/file to execute goes
> | here");
> | >
> | >
> | >
> | > In your 2nd chart it would look like this:
> | >
> | > If (Buy) StaticVarSetText("exec_2","script/file to execute goes
> | here");
> | >
> | >
> | >
> | > Then you will have a TimerControl.afl that reads each of these. 
See
> | > below for code sample. I have extracted this code from my own,
> | working,
> | > TimerControl module that sends out email alerts to me at 
designated
> | > times for multiple charts so it's not quite the same, but
> | adaptable.
> | >
> | >
> | >
> | > You could put your Chart 3 "time" code into TimerControl and
> | eliminate
> | > Chart 3 from your screen. Maybe someone else has a better time
> | delay
> | > function than mine.
> | >
> | >
> | >
> | > Note: If you're reading data very fast, this may not work as
> | expected or
> | > it may miss some signals. You'll have to try it out to see.
> | >
> | >
> | >
> | > /*************** Timer Control Code ******************/
> | >
> | > function wait (Seconds)
> | >
> | > {
> | >
> | >     end = Now(4) + Seconds;
> | >
> | >     while (Now(4) <= end)
> | >
> | >    {
> | >
> | >        sin(sqrt(123456789)); //Just to kill some time
> | >
> | >    }
> | >
> | > }
> | >
> | >
> | >
> | > /* Loop through up to 10 charts executing scripts for those with
> | data
> | > available. This has a roughly 1 second delay between executing 
each
> | > chart that has a signal. This may be inappropriate for you. You
> | may also
> | > need to collect all 9 charts and make decisions on which to
> | execute */
> | >
> | >
> | >
> | >     varName = "";
> | >
> | >     for (i = 1; i <= 10; i++)
> | >
> | >     {
> | >
> | >         varName = "exec_" + NumToStr(i,1.0);
> | >
> | >         //Build the name of the current chart being read.
> | >
> | >         varMsg = StaticVarGetText(varName);
> | >
> | >         if (varMsg == "") varName = "";
> | >
> | >         else
> | >
> | >         {
> | >
> | >             AlertIf(True,"EXEC", varMsg, 6,1+2,0); //Check 
options
> | >
> | >             StaticVarSetText(varName,""); //blank for next tick
> | >
> | >             wait(1); //1 second delay before reading next chart
> | >
> | >         }
> | >
> | >     }
> | >
> | >
> | >
> | > //Chart 3 code. Delete Chart 3 and replace with this module
> | >
> | >
> | >
> | > AddColumn(Hour(),"Hour");
> | >
> | > AddColumn(Minute(),"Minute");
> | >
> | > function time()
> | >
> | > {Time = Now(4);
> | >
> | > Seconds = int(Time%100);
> | >
> | > Minutes = int(Time/100%100);
> | >
> | > Hours = int(Time/10000%100);
> | >
> | > SecondNum = int(Hours*60*60+Minutes*60+Seconds);
> | >
> | > return Time;}
> | >
> | > Title ="\nTime: "+NumToStr(Time(),1.0,0);
> | >
> | >
> | >
> | > /*************** End Timer Control ******************/
> | >
> | > --
> | >
> | > Terry
> | >
> | >
> | >
> | > | -----Original Message-----
> | >
> | > | From: amibroker@xxxxxxxxxxxxxxx
> | [mailto:amibroker@xxxxxxxxxxxxxxx] On
> | >
> | > | Behalf Of livetraderman
> | >
> | > | Sent: Thursday, July 14, 2005 07:39
> | >
> | > | To: amibroker@xxxxxxxxxxxxxxx
> | >
> | > | Subject: [amibroker] Re: alertif exec - simultaneous trading
> | systems /
> | >
> | > | alerts
> | >
> | > |
> | >
> | > | Dear Terry,
> | >
> | > |
> | >
> | > | thank you very much for your help.
> | >
> | > |
> | >
> | > | I am not too deep into AFL coding.
> | >
> | > |
> | >
> | > | Could you help me out with a concrete sample for the code ?
> | >
> | > | Below as an example.
> | >
> | > |
> | >
> | > | Thank you !!!!
> | >
> | > |
> | >
> | > | Regards
> | >
> | > | Robert
> | >
> | > |
> | >
> | > |
> | >
> | > | Examle for my current setup:
> | >
> | > |
> | >
> | > | Chart 1 (EURUSD)
> | >
> | > |
> | >
> | > | Buy = Cross(condition);
> | >
> | > | Sell = 0;
> | >
> | > | Applystop...(loss limit)
> | >
> | > | Applystop...(profit Target)
> | >
> | > | alertif(Buy,"EXEC" .....,1);
> | >
> | > |
> | >
> | > | Chart 2 (USDJPY)
> | >
> | > |
> | >
> | > | Buy = Cross(condition);
> | >
> | > | Sell = 0;
> | >
> | > | Applystop...(loss limit)
> | >
> | > | Applystop...(profit Target)
> | >
> | > | alertif(Buy,"EXEC" .....,1);
> | >
> | > |
> | >
> | > | Chart 3 (time)
> | >
> | > |
> | >
> | > | AddColumn(Hour(),"Hour");
> | >
> | > | AddColumn(Minute(),"Minute");
> | >
> | > | function time()
> | >
> | > | {Time = Now(4);
> | >
> | > | Seconds = int(Time%100);
> | >
> | > | Minutes = int(Time/100%100);
> | >
> | > | Hours = int(Time/10000%100);
> | >
> | > | SecondNum = int(Hours*60*60+Minutes*60+Seconds);
> | >
> | > | return Time;}
> | >
> | > | Title ="\nTime: "+NumToStr(Time(),1.0,0);
> | >
> | > |
> | >
> | > | --- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxxx> 
wrote:
> | >
> | > | > Instead of doing separate AlertIf functions for each of 
your 9
> | >
> | > | charts,
> | >
> | > | > write a message to a staticVar. Static var names will
> | be "alert1"
> | >
> | > | > through "alert9". Then create a TimerControl chart which 
will
> | loop
> | >
> | > | > through each staticVar using a for loop 1 through 9 so you 
can
> | >
> | > | recreate
> | >
> | > | > each of these names in a loop. You will then have all 9 
Alerts
> | in-
> | >
> | > | hand
> | >
> | > | > simultaneously in a single place and can decide how to
> | prioritize
> | >
> | > | and/or
> | >
> | > | > delay multiple alerts.
> | >
> | > | >
> | >
> | > | > Each alert should be cleared by the TimerControl chart after
> | it is
> | >
> | > | read.
> | >
> | > | > --
> | >
> | > | > Terry
> | >
> | > | > | -----Original Message-----
> | >
> | > | > | From: amibroker@xxxxxxxxxxxxxxx
> | >
> | > | [mailto:amibroker@xxxxxxxxxxxxxxx] On
> | >
> | > | > | Behalf Of livetraderman
> | >
> | > | > | Sent: Thursday, July 14, 2005 01:11
> | >
> | > | > | To: amibroker@xxxxxxxxxxxxxxx
> | >
> | > | > | Subject: [amibroker] alertif exec - simultaneous trading
> | systems /
> | >
> | > | > | alerts
> | >
> | > | > |
> | >
> | > | > | Hello,
> | >
> | > | > |
> | >
> | > | > | I run Amibroker 4.70.5 RT version with esignal forex
> | datafeed.
> | >
> | > | > |
> | >
> | > | > | There are 9 different 5 minute charts opened 
simultaneously,
> | >
> | > | > | each with its own trading system running. The trading 
systems
> | >
> | > | > | generate e.g. BUY signals and I use "alterif" function to
> | execute
> | >
> | > | > | different exe files (macros of another application).
> | >
> | > | > |
> | >
> | > | > | Once in a while, when the independent trading systems
> | >
> | > | > | generate a buy signal coincidentally at the same time 
(hour
> | and
> | >
> | > | > | minute), accordingly alertif tries to execute two or more 
exe
> | >
> | > | files
> | >
> | > | > | simultaneously. This causes an error message of my third
> | party
> | >
> | > | > | application.
> | >
> | > | > |
> | >
> | > | > | My question: How can I prevent this to happen ?
> | >
> | > | > |
> | >
> | > | > | I would like to implement a solution which prevents this
> | >
> | > | successfully
> | >
> | > | > | e.g. with an "OR" function, but still lets me run my 9
> | different
> | >
> | > | > | trading systems on 9 different currency pairs. So to speak
> | like
> | >
> | > | > | a "filter" which controls the 9 different trading 
systems. I
> | >
> | > | thought
> | >
> | > | > | about using the "second()" function to differ the signals
> | from
> | >
> | > | each
> | >
> | > | > | other, but this leads to unwanted results due to delayed
> | order
> | >
> | > | > | execution (my strategy is scalping very small profit
> | targets).
> | >
> | > | > |
> | >
> | > | > | Thank you very much for your help in advance.
> | >
> | > | > |
> | >
> | > | > | Regards
> | >
> | > | > | Robert
> | >
> | > | > |
> | >
> | > | > |
> | >
> | > | > |
> | >
> | > | > |
> | >
> | > | > |
> | >
> | > | > |
> | >
> | > | > |
> | >
> | > | > | ------------------------ Yahoo! Groups Sponsor -----------
---
> | -----
> | >
> | > | -~--
> | >
> | > | > | >
> | >
> | > | > | Try Online Currency Trading with GFT. Free 50K Demo. Trade
> | >
> | > | > | 24 Hours. Commission-Free.
> | >
> | > | > | http://us.click.yahoo.com/DldnlA/9M2KAA/U1CZAA/GHeqlB/TM
> | >
> | > | > | ----------------------------------------------------------
---
> | -----
> | >
> | > | --~-
> | >
> | > | > | >
> | >
> | > | > |
> | >
> | > | > | Please note that this group is for discussion between 
users
> | only.
> | >
> | > | > |
> | >
> | > | > | To get support from AmiBroker please send an e-mail 
directly
> | to
> | >
> | > | > | SUPPORT {at} amibroker.com
> | >
> | > | > |
> | >
> | > | > | For other support material please check also:
> | >
> | > | > | http://www.amibroker.com/support.html
> | >
> | > | > |
> | >
> | > | > |
> | >
> | > | > | Yahoo! Groups Links
> | >
> | > | > |
> | >
> | > | > |
> | >
> | > | > |
> | >
> | > | > |
> | >
> | > |
> | >
> | > |
> | >
> | > |
> | >
> | > |
> | >
> | > | ------------------------ Yahoo! Groups Sponsor ---------------
---
> | --~--
> | >
> | > | >
> | >
> | > | Try Online Currency Trading with GFT. Free 50K Demo. Trade
> | >
> | > | 24 Hours. Commission-Free.
> | >
> | > | http://us.click.yahoo.com/DldnlA/9M2KAA/U1CZAA/GHeqlB/TM
> | >
> | > | --------------------------------------------------------------
---
> | ---~-
> | >
> | > | >
> | >
> | > |
> | >
> | > | Please note that this group is for discussion between users 
only.
> | >
> | > |
> | >
> | > | To get support from AmiBroker please send an e-mail directly 
to
> | >
> | > | SUPPORT {at} amibroker.com
> | >
> | > |
> | >
> | > | For other support material please check also:
> | >
> | > | http://www.amibroker.com/support.html
> | >
> | > |
> | >
> | > |
> | >
> | > | Yahoo! Groups Links
> | >
> | > |
> | >
> | > |     http://groups.yahoo.com/group/amibroker/
> | >
> | > |
> | >
> | > |     amibroker-unsubscribe@xxxxxxxxxxxxxxx
> | >
> | > |
> | >
> | > |     http://docs.yahoo.com/info/terms/
> | >
> | > |
> | 
> | 
> | 
> | 
> | 
> | ------------------------ Yahoo! Groups Sponsor -------------------
-~--
> | >
> | Try Online Currency Trading with GFT. Free 50K Demo. Trade
> | 24 Hours. Commission-Free.
> | http://us.click.yahoo.com/DldnlA/9M2KAA/U1CZAA/GHeqlB/TM
> | ------------------------------------------------------------------
--~-
> | >
> | 
> | Please note that this group is for discussion between users only.
> | 
> | To get support from AmiBroker please send an e-mail directly to
> | SUPPORT {at} amibroker.com
> | 
> | For other support material please check also:
> | http://www.amibroker.com/support.html
> | 
> | 
> | Yahoo! Groups Links
> | 
> | 
> | 
> |




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/DldnlA/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/