Search the web
Sign In
New User? Sign Up
amibroker · AmiBroker User's List
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 144188 - 144217 of 144217   Newest  |  < Newer  |  Older >  |  Oldest
Messages: Show Message Summaries   (Group by Topic) Sort by Date v  
#144217 From: "potatosoupz" <potatosoupz@...>
Date: Mon Nov 23, 2009 3:46 pm
Subject: Why is AB constantly taking up between 20-40% of my CPU?
potatosoupz
Offline Offline
Send Email Send Email
 
Even over the weekend when no data was coming in, it just sucks the CPU up. I
have dual core Opteron machine, with 4GB of RAM and am running Windows 7. I'm
finding AB to be very slow, even right clicking on a chart there is a 1 second
delay for the menu to appear. What is the reason for this? Is this normal?

#144216 From: "Markus Witzler" <funnybiz@...>
Date: Mon Nov 23, 2009 3:45 pm
Subject: Re: Computing and plotting historical portfolio metrics in CBT
bakijahadzis...
Offline Offline
Send Email Send Email
 
Hi Mike,
 
do you have a clue for me?
 
Thanks
 
Markus
----- Original Message -----
Sent: Sunday, November 22, 2009 12:16 PM
Subject: Re: [amibroker] Re: Computing and plotting historical portfolio metrics in CBT

Hello again, Mike!
 
Nope, I wanted to code my_equity to get a grasp of how CBT actually works.
 
I´m aware that my_equity is the same as ~~~Equity. I later want to modify my code to test my systems with different versions of my_equity, for instance
 
my_equity = cash position plus profit of all open positions (locked up by a stop).
 
I gues Van Tharp calls this "reduced total equity". I want to explore how testing results change if I change the definition of my_equity.
 
But again, I first need to know where the flaw in my code is. Otherwhise, I have no chance to proceed any further.
 
Thanks
 
Markus
 
 
 
 
----- Original Message -----
From: Mike
Sent: Sunday, November 22, 2009 6:52 AM
Subject: [amibroker] Re: Computing and plotting historical portfolio metrics in CBT

 

Markus,

If all you want is a copy of the ~~~Equity that AmiBroker already calculates for you, then there is no need to do any specialized signal/trade handling.

Just do the following:

SetCustombacktestProc("");

if (Status("action") == actionPortfolio
) {
   bo =
GetBacktesterObject
();
   bo.Backtest();
   
AddToComposite(Foreign("~~~Equity", "C"), "~my_equity", "X", atcFlagDefaults | atcFlagEnableInPortfolio
);
}

Plot(Foreign("~my_equity", "C"), "My Equity", colorBlue, styleLine);

Mike


--- In amibroker@yahoogroups.com, "Markus Witzler" <funnybiz@...> wrote:
>
> Hello,
>
> I want to compute and plot my own equity (labeled my_equity).
>
> In the code below (I skkipped the signal part with buy and sell signal), I wonder why my_equity
>
> - is not being shown in backtester report
>
> - can´t be plotted
>
> - doesn´t show up in exploration
>
> Why is that? If you reauire the rest of the code, please let me know
>
> Thanks
>
> Markus
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> ...<snip >...
>
> for (trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos())
>
> {
>
> trade = bo.findopenpos (sig.symbol);
>
> if (trade)
>
> {
>
> value_all_open_pos=value_all_open_pos + trade.GetPrice(i, "C") * trade.shares;
>
> }
>
>
>
> }
>
> bo.HandleStops(i); // Process programmed stops or applystop at this bar
>
> my_equity [i] = bo.cash + value_all_open_pos;
>
> } // End of for loop over signals at this bar
>
>
> bo.UpdateStats(i, 1); // Update MAE/MFE stats for bar
>
> bo.UpdateStats(i, 2); // Update stats at bar's end
>
> } // End of for loop over bars
>
> bo.PostProcess(); // Do post-processing
>
> AddToComposite(my_equity, "~~~my_equity","x", atcFlagEnableInPortfolio | atcFlagDefaults);
>
> }
>
> PlotForeign("~~~my_equity", "my_equity", colorRed, styleHistogram );
>



__________ Information from ESET Smart Security, version of virus signature database 4627 (20091121) __________

The message was checked by ESET Smart Security.

http://www.eset.com


__________ Information from ESET Smart Security, version of virus signature database 4627 (20091121) __________

The message was checked by ESET Smart Security.

http://www.eset.com

#144215 From: "iqfeed" <iqfeed@...>
Date: Mon Nov 23, 2009 3:18 pm
Subject: Re: Tick data, how important is bids/asks?
iqfeed
Offline Offline
Send Email Send Email
 
Just to clarify, IQFeed does provide bid/ask quotes in the stream.  We send
every trade, as well as every bid/ask price and volume update.  We don't store
each bid/ask update in history however.  Instead, we only store trades, and the
bid/ask price at the time of the trade which allows 3rd party software to
determine if a trade occured at the bid or the ask.  Trades are often
interpreted as a buy or a sell based on if the trade hit the bid or ask and we
provide the information needed to determine this.


--- In amibroker@yahoogroups.com, "Potato Soup" <potatosoupz@...> wrote:
>
> I'm working with IQFeed tick data. They don't seem to provide bid/ask quotes,
just trades. What's the consensus on whether this matters? I've seen it argued
that a lot of games go on with quotes, fakeouts, etc. And that trade ticks are
all that matter. Seems though for less liquid instruments you'd really want
updated quotes, or the true price could be quite far from the last trade.
>
> I realize most AmiBroker users don't trade on ticks, but thought I'd ask here
for comment anyway.
>

#144214 From: "Tim" <raven4ns@...>
Date: Mon Nov 23, 2009 2:44 pm
Subject: Re: US$ INDEX
raven4ns
Offline Offline
Send Email Send Email
 
Thank you everyone for your help. It would appear the only way to get the data
for the DXY is to subscribe to a service like DTN. I do appreciate all your
suggestions though and thank you once again.


Tim

--- In amibroker@yahoogroups.com, "Tim" <raven4ns@...> wrote:
>
> Hello,
>  Does anyone know of a way to get free data for this index? YAHOO, GOOGLE, MSN
don't carry it that I am aware of. I would like to follow it so any help is most
appreciated. Thank you.
>
> Kindest regards,
>
> Tim
>

#144213 From: Asis Ghosh <subhamedicalsjpg@...>
Date: Mon Nov 23, 2009 7:08 am
Subject: [Fwd: IST Time Adjustments with ET in AMI:]
subhamedical...
Online Now Online Now
Send Email Send Email
 


-------- Original Message --------
Subject: IST Time Adjustments with ET in AMI:
Date: Mon, 23 Nov 2009 12:36:20 +0530
From: Asis Ghosh <subhamedicalsjpg@...>
Reply-To: subhamedicalsjpg@...
Organization: Subha Medicals
To: AMIBROKER SUPPORT <support@...>, amibroker@yahoogroups.com


When I use QT/MT4 plug-in--for exact time (local) settings>DATA BASE SETTINGS>INTRA DAY SETTINGS>PER DATABASE SETTINGS>TIME SHIFT.

Here in TIME SHIFT options--the field only take integers such as 10/9 hours--but IST (India) is 9.5 HOURS + wrt to ET--so I have to put it as either 10/9 hours (nearest)--both of these will show 30 mins difference(+/-) with IST (Local Time)--is there any way to correct it--so that my AMI Chart will show exact IST/Local Time & data ?

Asis


#144212 From: Deepak Patade <deepakpatade@...>
Date: Mon Nov 23, 2009 6:46 am
Subject: Re: Re: witing value on chart
deepakpatade
Offline Offline
Send Email Send Email
 
thankyou wooziwog
It works
Yes we are proud of our senior learned members
 
Deepak Patade,
Nasik.



From: wooziwog <xcitemint@...>
To: amibroker@yahoogroups.com
Sent: Mon, November 23, 2009 12:09:14 PM
Subject: [amibroker] Re: witing value on chart

 

Two functions can be used to accomplish this, GFXDrawText or PlotText. The following example appears under PlotText in the AFL Functions Reference:
Plot(C,"Price" , colorBlack, styleLine );
Plot(MA(C,20) ,"MA20", colorRed );

Buy=Cross( C, MA(C,20 ) );
Sell= Cross( MA( C, 20 ), C );

dist = 1.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n@" + C[ i ], i, L[ i ]-dist[i], colorGreen );
if( Sell[i] ) PlotText( "Sell\n@" + C[ i ], i, H[ i ]+dist[i], colorRed, colorYellow );
}

PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorGreen, colorRed ) );

Copy and Paste it - with slight modification it should serve your purpose.

David K.

--- In amibroker@yahoogrou ps.com, Deepak Patade <iamdeepakpatade@ ...> wrote:
>
> how can i write the value on chart for a signal generated.
> i want it at the spot where there is a arrow on the chart and not at the
> left top corner.
> So whever a buy/sell is generated it writes the value at that point
> Tried writeval, but it writes at the corner
>



#144211 From: "fxbearwatcher" <fxbearwatcher@...>
Date: Thu Nov 19, 2009 1:32 pm
Subject: RE: Re: US$ INDEX
fxbearwatcher
Offline Offline
Send Email Send Email
 

Here is the Yahoo link for the $US Index

 

http://finance.yahoo.com/q?s=DX-Y.NYB

 

Hope this is what you are looking for

 

Cheers

 

Gary

 

 

-----Original Message-----
From: amibroker@yahoogroups.com [mailto:amibroker@yahoogroups.com]On Behalf Of Nick de Peyster
Sent: November 19, 2009 06:09
To: amibroker@yahoogroups.com
Subject: Re: [amibroker] Re: US$ INDEX

 

 

Tim,

 

It's on the federal reserve website.  I sent you the link.  DXY, I think, is the G10 index.

--- On Thu, 11/19/09, Tim <raven4ns@yahoo.ca> wrote:


From: Tim <raven4ns@yahoo.ca>
Subject: [amibroker] Re: US$ INDEX
To: amibroker@yahoogroups.com
Date: Thursday, November 19, 2009, 2:45 AM

 

Thank you for your suggestions. I was hoping there might be a way to get the DXY data which is the US$ index but I guess not. It makes tracking the US$ much easier especially since so many people relate to this index. Thank you again for responding.

Best regards,

Tim

--- In amibroker@yahoogrou ps.com, "Tim" <raven4ns@.. .> wrote:
>
> Hello,
> Does anyone know of a way to get free data for this index? YAHOO, GOOGLE, MSN don't carry it that I am aware of. I would like to follow it so any help is most appreciated. Thank you.
>
> Kindest regards,
>
> Tim
>

This message has been processed by Firetrust Benign.


#144210 From: reinsley <reinsley@...>
Date: Mon Nov 23, 2009 8:31 am
Subject: Re: Re: witing value on chart
reinsley
Offline Offline
Send Email Send Email
 
In the User's KB

http://www.amibroker.org/userkb/2009/02/21/plotting-trades-on-chart/

Best regards


wooziwog a écrit :
>
>
> Two functions can be used to accomplish this, GFXDrawText or PlotText.
> The following example appears under PlotText in the AFL Functions Reference:
> Plot(C,"Price", colorBlack, styleLine );
> Plot(MA(C,20),"MA20", colorRed );
>
> Buy=Cross( C, MA(C,20 ) );
> Sell= Cross( MA( C, 20 ), C );
>
> dist = 1.5*ATR(10);
>
> for( i = 0; i < BarCount; i++ )
> {
> if( Buy[i] ) PlotText( "Buy\n@" + C[ i ], i, L[ i ]-dist[i], colorGreen );
> if( Sell[i] ) PlotText( "Sell\n@" + C[ i ], i, H[ i ]+dist[i], colorRed,
> colorYellow );
> }
>
> PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy,
> colorGreen, colorRed ) );
>
> Copy and Paste it - with slight modification it should serve your purpose.
>
> David K.
>
> --- In amibroker@yahoogroups.com <mailto:amibroker%40yahoogroups.com>,
> Deepak Patade <iamdeepakpatade@...> wrote:
>  >
>  > how can i write the value on chart for a signal generated.
>  > i want it at the spot where there is a arrow on the chart and not at the
>  > left top corner.
>  > So whever a buy/sell is generated it writes the value at that point
>  > Tried writeval, but it writes at the corner
>  >
>
>

#144209 From: "Mike" <sfclimbers@...>
Date: Mon Nov 23, 2009 6:59 am
Subject: Re: JAVA SCRIPT SIMPLE QUESTIONS
sfclimbers
Offline Offline
Send Email Send Email
 
1. I have not tried running your code. But a few observations:
a) Before ever running the script, you might want to consider saving your
settings out to file such that you may load them in from your JScript to ensure
a consistent environment. This is also the only way that I've found to set your
optimization target by the way.

b) No need to wrap Explore call in braces (i.e. don't need {}). Same with block
for exporting.

c) Don't think that you need to save your database or restore all after the
exploration.

2. AB.ActiveDocument.Name = "RUT-I";

3. Not sure what you're asking here. Do you want to generate 10 .csv files, or
read in from 10 .csv files? Assuming that you want to generate files, you can do
the preparations/explore/export in a loop.

Mike

--- In amibroker@yahoogroups.com, "bistrader" <bistrader@...> wrote:
>
> I created the following Java Script to do an exploration on an afl and then
export the exploration to a file.  I have a few questions.
>
> 1. From a structure perspective, is there anything that I should include or
exclude as I try to pick up Java Script.
> 2. I can not figure out how to load a reference symbol like "RUT-I" with is
the R2000 so that AmiBroker knows the valid market days.
> 3. How to change the following if I want to loop through 10 csv files rather
than just the watchlist 9 used in the following?  That is, do this 10 times
automatically but on csv files named In1.csv to In10.csv, if you will.
>
> By the way, I am going through a learning process to expand my knowledge on
what to do in afl, what to do in Java Script and what to do in AutoIt.  This is
part of that process.
>
> // Build_JavaScript.js
>
> //  This Java Script file should:
> //  1. Load a Database
> //  2. Run an exploration on an afl.
> //  3. Export the exploration to a csv file.
>
> //
----------------------------------------------------------------------------
> // Create AmiBroker object and get Analysis object
> //
----------------------------------------------------------------------------
> var AB, AA, i;
>
> AB = new ActiveXObject("Broker.Application");
> AA = AB.Analysis;
>
> //
----------------------------------------------------------------------------
> // Load Database
> //
----------------------------------------------------------------------------
> AB.LoadDatabase("C:\\Amibroker\\FastTrack");
>
> //
----------------------------------------------------------------------------
> // Automatic Analysis Input and Export Information
> //
----------------------------------------------------------------------------
> AFL_Directory = "C:\\Amibroker\\AFL\\";                  // Location of AFL
> AFL_ExploreFileName = "0_DataExport.afl";                // AFL program to get
the data to be exported
> AFL_ExploreFile = AFL_Directory + AFL_ExploreFileName;   // Name of the above
program with it's path included
>
> Export_Directory = "C:\\Amibroker\\Temp\\";              // Location where
Exported data will be saved
> ExportFileName = "MyCsvFile.csv";                        // Name of export
file
> ExportFile = Export_Directory + ExportFileName;          // Name of above
export file with its path included
>
> //
----------------------------------------------------------------------------
> // Setup Exploration using info defined above
> //
----------------------------------------------------------------------------
> AA.LoadFormula( AFL_ExploreFile );
>
> // Use the following to tell Amibroker what to Include/Exclude and what dates
to use
> //
> // "index", "favorite", "market", "group", "sector", "index", "watchlist"
> // 0 = include; 1 = exclude
> // 0 = all stocks, 1 = current stock, 2 = use filter
> // 0 = all quotes, 1 = n last quotes, 2 = n last days, 3 = from-to date
> //
>
> // Set Filters
> AA.ClearFilters();
> // AA.Filter(0,"favorite") = 1;   // Try this to load a long ticker which is
favorites ^rut
> AA.Filter(0,"watchlist") = 9;     // 0 = Include; "watchlist" 57 contains the
SP500 component stocks
> AA.ApplyTo = 2;                   // 0 = all stocks, 1 = current stock, 2 =
use filter
>
> // Set Dates
> AA.RangeMode = 3;                    // 0 = all quotes, 1 = n last quotes, 2 =
n last days, 3 = from-to date
> //AA.RangeN = 5000;
> AA.RangeFromDate = "12/31/2002";
> AA.RangeToDate = "12/31/2099";
>
> //
----------------------------------------------------------------------------
> // Run exploration, export exploration to csv file
> //
----------------------------------------------------------------------------
> {AA.Explore();}
>
> {AA.Export( ExportFile );
>
>
> AB.SaveDatabase();
>
> AB.RefreshAll();}
>
> //AA.ShowWindow(0);                     // 0 = all stocks, 1 = current stock,
2 = use filter
>
> // The End
> //
--------------------------------------------------------------------------------\
--------------------------
>

#144208 From: "wooziwog" <xcitemint@...>
Date: Mon Nov 23, 2009 6:39 am
Subject: Re: witing value on chart
wooziwog
Offline Offline
Send Email Send Email
 
Two functions can be used to accomplish this, GFXDrawText or PlotText.  The
following example appears under PlotText in the AFL Functions Reference:
Plot(C,"Price", colorBlack, styleLine );
Plot(MA(C,20),"MA20", colorRed );

Buy=Cross( C, MA(C,20 ) );
Sell= Cross( MA( C, 20 ), C );

dist = 1.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n@" + C[ i ], i, L[ i ]-dist[i], colorGreen );
if( Sell[i] ) PlotText( "Sell\n@" + C[ i ], i, H[ i ]+dist[i], colorRed,
colorYellow );
}

PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorGreen,
colorRed ) );

Copy and Paste it - with slight modification it should serve your purpose.

David K.

--- In amibroker@yahoogroups.com, Deepak Patade <iamdeepakpatade@...> wrote:
>
> how can i write the value on chart for a signal generated.
> i want it at the spot where there is a arrow on the chart and not at the
> left top corner.
> So whever a buy/sell is generated it writes the value at that point
> Tried writeval, but it writes at the corner
>

#144207 From: Deepak Patade <iamdeepakpatade@...>
Date: Mon Nov 23, 2009 4:57 am
Subject: witing value on chart
iamdeepakpatade@...
Send Email Send Email
 
how can i write the value on chart for a signal generated.
i want it at the spot where there is a arrow on the chart and not at the left top corner.
So whever a buy/sell is generated it writes the value at that point
Tried writeval, but it writes at the corner

#144206 From: Alan <alan@...>
Date: Mon Nov 23, 2009 1:59 am
Subject: Re: Re=Days since DMI crossover
alannortham
Offline Offline
Send Email Send Email
 
Anthony,

Your code does exactly what I wanted.  Thanks for the time invested in
helping me solve my problem.

Alan,


Anthony Faragasso wrote:
>
>
> Alan,
>
> run this in explore mode....I will post for indicator builder later if
> you want to visualize....
>
> Anthony
>
>
> Mmdi=*MDI*(*Param*("NedMDI",14,1,20,1));
>
> Ppdi=*PDI*(*Param*("PosPDI",14,1,20,1));
>
> Crossup=*Cross*(Ppdi,Mmdi);
>
> Crossdown=*Cross*(Mmdi,Ppdi);
>
> **
>
> *Filter*=1;
>
> /***Current State ******/
>
> stateUp=*BarsSince*(Mmdi > Ppdi);
>
> stateDown=*BarsSince*(Mmdi < Ppdi);
>
> **
>
> *AddColumn*(stateUp,"currentUp");
>
> **
>
> *AddColumn*(statedown,"CurrentDown");
>
>
>
>     ----- Original Message -----
>     *From:* Alan <mailto:alan@...>
>     *To:* amibroker@yahoogroups.com <mailto:amibroker@yahoogroups.com>
>     *Sent:* Sunday, November 22, 2009 3:03 PM
>     *Subject:* Re: [amibroker] Re=Days since DMI crossover
>
>
>
>     Hi Anthony:
>
>     Thank you for your interest in helping me with my problem.  I want
>     to either do a Scan or an Exploration that will generate a table
>     of stocks where the negative DMI has crossed above the positive
>     DMI and show how many days ago the crossover took place.  I am
>     using a Filtered list that contains the 100 stocks comprising the
>     QQQQ's which I have previously submitted to the forum as an
>     attachment.
>
>     Regards,
>     Alan
>
>
>     Anthony Faragasso wrote:
>
>>     Hi Alan,
>>
>>     Please post your rules again....I will revert with possible solution..
>>
>>     Anthony
>>
>>
>>     ----- Original Message -----
>>     From: "Alan" <alan@...>
>>     To: <amibroker@yahoogroups.com>
>>     Sent: Sunday, November 22, 2009 9:29 AM
>>     Subject: Re: [amibroker] Re=Days since DMI crossover
>>
>>
>>
>>>     Hi soni67c:
>>>
>>>     Thanks for the code. I tried it and here is a snippit of the results
>>>     after a scan:
>>>
>>>     Ticker Trade Date Close
>>>     AAPL Sell 10/28/2009 192.4
>>>     AAPL Buy 11/5/2009 194.03
>>>     AAPL Sell 11/20/2009 199.92
>>>     ADBE Sell 10/22/2009 35.17
>>>
>>>
>>>     This table shows a sell signal on 10/28/09 while MDI is still positive,
>>>     a buy signal on 11/05 when on the stock chart is shows a buy signal on
>>>     11/04, and the table shows a sell signal on 11/20/09 again while MDI is
>>>     still positive. So I must not be doing something right. I am using a
>>>     filter list of the QQQQ's and Scan set for n=30. Any ideas why I am
>>>     getting these results?
>>>
>>>     Regards,
>>>     Alan
>>>
>>>     soni67c wrote:
>>>
>>>>     Hello Alan,
>>>>     Check this formula...this is what you want :).
>>>>
>>>>     Range = Param(" +DI - D range", 10, 5, 30,1 );
>>>>     Plot(PDI(Range),"",5,1);
>>>>     Plot(MDI(Range),"",4,1);
>>>>     Plot(ADX(Range),"",13,1);
>>>>     Buy = Cross(PDI(Range), MDI(Range));
>>>>     Sell = Cross(MDI(Range), PDI(Range));
>>>>     PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,20,0);
>>>>     PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,20,0);
>>>>     bars=SelectedValue(Min( BarsSince( Cross(PDI(Range) , MDI(Range) )),
>>>>     BarsSince( Cross( MDI(Range), PDI(Range))) ));
>>>>     prevclose=Ref(Close,-bars);
>>>>     Com=EncodeColor(colorTan)+("\n\nCurrently the +DMI ("+Range+") is "+
>>>>     WriteIf(PDI(Range) > MDI(Range),"bullish","bearish")+", and it crossed
"+
>>>>     WriteIf(PDI(Range) > MDI(Range),"above","below")+" -DMI ("+Range+")
>>>>     ."+"\n"+EncodeColor(colorAqua)+
>>>>     WriteVal( Min( BarsSince( Cross( PDI(Range), MDI(Range) )), BarsSince(
>>>>     Cross( MDI(Range), PDI(Range)))), 0.0)+
>>>>     " period(s) ago.")+EncodeColor(colorTan)+
>>>>     Com=("\n\nSince the +DMI crossed -DMI, "+Name()+ "'s price has :
>>>>     ")+EncodeColor(colorGold)+"\n"+
>>>>     WriteIf(Close>prevclose,"increased %","decreased
>>>>     %")+WriteVal(100*(Close-prevclose)/prevclose)+
>>>>     EncodeColor(colorTan)+Com=("\n\nAnd has ranged from a high of "+
>>>>     WriteVal(HHV(High,bars+1),6.2)+" to a low of
>>>>     "+WriteVal(LLV(Low,bars+1),6.2));
>>>>     Title = EncodeColor(colorWhite)+ "ABS3" + " - " + Name() +
>>>>     EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
>>>>     " - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+"
>>>>     "+"Hi-"+H+" "+"Lo-"+L+" "+
>>>>     "Cl-"+C+" "+ "Vol= "+ WriteVal(V)+ Com;
>>>>
>>>>     Thank you
>>>>
>>>>
>>>>
>>>>
>>>>     __________ Information from ESET NOD32 Antivirus, version of virus
>>>>     signature database 4627 (20091121) __________
>>>>
>>>>     The message was checked by ESET NOD32 Antivirus.
>>>>
>>>>     http://www.eset.com
>>>>
>>>     ------------------------------------
>>>
>>>     **** IMPORTANT PLEASE READ ****
>>>     This group is for the discussion between users only.
>>>     This is *NOT* technical support channel.
>>>
>>>     TO GET TECHNICAL SUPPORT send an e-mail directly to
>>>     SUPPORT {at} amibroker.com
>>>
>>>     TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>>>     http://www.amibroker.com/feedback/
>>>     (submissions sent via other channels won't be considered)
>>>
>>>     For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>>>     http://www.amibroker.com/devlog/
>>>
>>>     Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>
>>
>>
>>     ------------------------------------
>>
>>     **** IMPORTANT PLEASE READ ****
>>     This group is for the discussion between users only.
>>     This is *NOT* technical support channel.
>>
>>     TO GET TECHNICAL SUPPORT send an e-mail directly to
>>     SUPPORT {at} amibroker.com
>>
>>     TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>>     http://www.amibroker.com/feedback/
>>     (submissions sent via other channels won't be considered)
>>
>>     For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>>     http://www.amibroker.com/devlog/
>>
>>     Yahoo! Groups Links
>>
>>
>>
>>
>>     __________ Information from ESET NOD32 Antivirus, version of virus
signature database 4627 (20091121) __________
>>
>>     The message was checked by ESET NOD32 Antivirus.
>>
>>     http://www.eset.com
>>
>>
>>
>>
>>
>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4628 (20091122) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com

#144205 From: Brenton Hill <bphill0105@...>
Date: Sun Nov 22, 2009 11:15 pm
Subject: Re: JAVA SCRIPT SIMPLE QUESTIONS
bphill0105
Offline Offline
Send Email Send Email
 
Hi Bistrader

If you're using AutoIT anyway, you can skip using Java Script altogether and just control Amibroker direct from AutoIT.

In AutoIT use:

$AB = ObjCreate("broker.application")
$AA = $AB.Analysis
$AB.LoadDatabase("C:\\Amibroker\\FastTrack")

etc

Not sure about your Question 2, sorry.

If by ques 3, you mean you want to explore 10 different watchlists (eg WL numbers 1 to 10) and export 10 csv files, then just put set filter, explore and export in a loop

$Export_Directory = "C:\\Amibroker\\Temp\\"; // Location where Exported data will be saved
$ExportFileName = "MyCsvFile"; // Name of export file
$ExportFile = Export_Directory + ExportFileName; // Name of above export file with its path included

    For $i = 1 To 10
        $AA.Filter( 0, "watchlist" ) = $i
        $AA.Explore()
        $AA.Export($ExportFile&$i&".csv")
    Next

Brenton

bistrader wrote:
 

I created the following Java Script to do an exploration on an afl and then export the exploration to a file. I have a few questions.

1. From a structure perspective, is there anything that I should include or exclude as I try to pick up Java Script.
2. I can not figure out how to load a reference symbol like "RUT-I" with is the R2000 so that AmiBroker knows the valid market days.
3. How to change the following if I want to loop through 10 csv files rather than just the watchlist 9 used in the following? That is, do this 10 times automatically but on csv files named In1.csv to In10.csv, if you will.

By the way, I am going through a learning process to expand my knowledge on what to do in afl, what to do in Java Script and what to do in AutoIt. This is part of that process.

// Build_JavaScript.js

// This Java Script file should:
// 1. Load a Database
// 2. Run an exploration on an afl.
// 3. Export the exploration to a csv file.

// ----------------------------------------------------------
// Create AmiBroker object and get Analysis object
// ----------------------------------------------------------
var AB, AA, i;

AB = new ActiveXObject("Broker.Application");
AA = AB.Analysis;

// ----------------------------------------------------------
// Load Database
// ----------------------------------------------------------
AB.LoadDatabase("C:\\Amibroker\\FastTrack");

// ----------------------------------------------------------
// Automatic Analysis Input and Export Information
// ----------------------------------------------------------
AFL_Directory = "C:\\Amibroker\\AFL\\"; // Location of AFL
AFL_ExploreFileName = "0_DataExport.afl"; // AFL program to get the data to be exported
AFL_ExploreFile = AFL_Directory + AFL_ExploreFileName; // Name of the above program with it's path included

Export_Directory = "C:\\Amibroker\\Temp\\"; // Location where Exported data will be saved
ExportFileName = "MyCsvFile.csv"; // Name of export file
ExportFile = Export_Directory + ExportFileName; // Name of above export file with its path included

// ----------------------------------------------------------
// Setup Exploration using info defined above
// ----------------------------------------------------------
AA.LoadFormula( AFL_ExploreFile );

// Use the following to tell Amibroker what to Include/Exclude and what dates to use
//
// "index", "favorite", "market", "group", "sector", "index", "watchlist"
// 0 = include; 1 = exclude
// 0 = all stocks, 1 = current stock, 2 = use filter
// 0 = all quotes, 1 = n last quotes, 2 = n last days, 3 = from-to date
//

// Set Filters
AA.ClearFilters();
// AA.Filter(0,"favorite") = 1; // Try this to load a long ticker which is favorites ^rut
AA.Filter(0,"watchlist") = 9; // 0 = Include; "watchlist" 57 contains the SP500 component stocks
AA.ApplyTo = 2; // 0 = all stocks, 1 = current stock, 2 = use filter

// Set Dates
AA.RangeMode = 3; // 0 = all quotes, 1 = n last quotes, 2 = n last days, 3 = from-to date
//AA.RangeN = 5000;
AA.RangeFromDate = "12/31/2002";
AA.RangeToDate = "12/31/2099";

// ----------------------------------------------------------
// Run exploration, export exploration to csv file
// ----------------------------------------------------------
{AA.Explore();}

{AA.Export( ExportFile );

AB.SaveDatabase();

AB.RefreshAll();}

//AA.ShowWindow(0); // 0 = all stocks, 1 = current stock, 2 = use filter

// The End
// ----------------------------------------------------------



__________ Information from ESET Smart Security, version of virus signature database 4628 (20091122) __________

The message was checked by ESET Smart Security.

http://www.eset.com


__________ Information from ESET Smart Security, version of virus signature database 4628 (20091122) __________

The message was checked by ESET Smart Security.

http://www.eset.com

#144204 From: "Anthony Faragasso" <ajf1111@...>
Date: Sun Nov 22, 2009 9:01 pm
Subject: Re: Re=Days since DMI crossover
ajf1111us2000
Offline Offline
Send Email Send Email
 
Alan,
 
run this in explore mode....I will post for indicator builder later if you want to visualize....
 
Anthony
 

Mmdi=MDI(Param("NedMDI",14,1,20,1));

Ppdi=PDI(Param("PosPDI",14,1,20,1));

Crossup=Cross(Ppdi,Mmdi);

Crossdown=Cross(Mmdi,Ppdi);

Filter=1;

/***Current State ******/

stateUp=BarsSince(Mmdi > Ppdi);

stateDown=BarsSince(Mmdi < Ppdi);

AddColumn(stateUp,"currentUp");

AddColumn(statedown,"CurrentDown");

 
----- Original Message -----
From: Alan
Sent: Sunday, November 22, 2009 3:03 PM
Subject: Re: [amibroker] Re=Days since DMI crossover

 

Hi Anthony:

Thank you for your interest in helping me with my problem.  I want to either do a Scan or an Exploration that will generate a table of stocks where the negative DMI has crossed above the positive DMI and show how many days ago the crossover took place.  I am using a Filtered list that contains the 100 stocks comprising the QQQQ's which I have previously submitted to the forum as an attachment.

Regards,
Alan


Anthony Faragasso wrote:

Hi Alan,
Please post your rules again....I will revert with possible solution..
Anthony
----- Original Message ----- From: "Alan" <alan@thenorthams.us>
To: <amibroker@yahoogroups.com>
Sent: Sunday, November 22, 2009 9:29 AM
Subject: Re: [amibroker] Re=Days since DMI crossover
Hi soni67c:
Thanks for the code. I tried it and here is a snippit of the results
after a scan:
Ticker Trade Date Close
AAPL Sell 10/28/2009 192.4
AAPL Buy 11/5/2009 194.03
AAPL Sell 11/20/2009 199.92
ADBE Sell 10/22/2009 35.17
This table shows a sell signal on 10/28/09 while MDI is still positive,
a buy signal on 11/05 when on the stock chart is shows a buy signal on
11/04, and the table shows a sell signal on 11/20/09 again while MDI is
still positive. So I must not be doing something right. I am using a
filter list of the QQQQ's and Scan set for n=30. Any ideas why I am
getting these results?
Regards,
Alan
soni67c wrote:
Hello Alan,
Check this formula...this is what you want :).
Range = Param(" +DI - D range", 10, 5, 30,1 );
Plot(PDI(Range),"",5,1);
Plot(MDI(Range),"",4,1);
Plot(ADX(Range),"",13,1);
Buy = Cross(PDI(Range), MDI(Range));
Sell = Cross(MDI(Range), PDI(Range));
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,20,0);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,20,0);
bars=SelectedValue(Min( BarsSince( Cross(PDI(Range) , MDI(Range) )),
BarsSince( Cross( MDI(Range), PDI(Range))) ));
prevclose=Ref(Close,-bars);
Com=EncodeColor(colorTan)+("\n\nCurrently the +DMI ("+Range+") is "+
WriteIf(PDI(Range) > MDI(Range),"bullish","bearish")+", and it crossed "+
WriteIf(PDI(Range) > MDI(Range),"above","below")+" -DMI ("+Range+")
."+"\n"+EncodeColor(colorAqua)+
WriteVal( Min( BarsSince( Cross( PDI(Range), MDI(Range) )), BarsSince(
Cross( MDI(Range), PDI(Range)))), 0.0)+
" period(s) ago.")+EncodeColor(colorTan)+
Com=("\n\nSince the +DMI crossed -DMI, "+Name()+ "'s price has :
")+EncodeColor(colorGold)+"\n"+
WriteIf(Close>prevclose,"increased %","decreased
%")+WriteVal(100*(Close-prevclose)/prevclose)+
EncodeColor(colorTan)+Com=("\n\nAnd has ranged from a high of "+
WriteVal(HHV(High,bars+1),6.2)+" to a low of
"+WriteVal(LLV(Low,bars+1),6.2));
Title = EncodeColor(colorWhite)+ "ABS3" + " - " + Name() +
EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+"
"+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+ Com;
Thank you
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4627 (20091121) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links

------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
amibroker-digest@yahoogroups.com amibroker-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4627 (20091121) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com


#144203 From: "bistrader" <bistrader@...>
Date: Sun Nov 22, 2009 8:42 pm
Subject: JAVA SCRIPT SIMPLE QUESTIONS
bistrader
Offline Offline
Send Email Send Email
 
I created the following Java Script to do an exploration on an afl and then
export the exploration to a file.  I have a few questions.

1. From a structure perspective, is there anything that I should include or
exclude as I try to pick up Java Script.
2. I can not figure out how to load a reference symbol like "RUT-I" with is the
R2000 so that AmiBroker knows the valid market days.
3. How to change the following if I want to loop through 10 csv files rather
than just the watchlist 9 used in the following?  That is, do this 10 times
automatically but on csv files named In1.csv to In10.csv, if you will.

By the way, I am going through a learning process to expand my knowledge on what
to do in afl, what to do in Java Script and what to do in AutoIt.  This is part
of that process.

// Build_JavaScript.js

//  This Java Script file should:
//  1. Load a Database
//  2. Run an exploration on an afl.
//  3. Export the exploration to a csv file.

// ----------------------------------------------------------------------------
// Create AmiBroker object and get Analysis object
// ----------------------------------------------------------------------------
var AB, AA, i;

AB = new ActiveXObject("Broker.Application");
AA = AB.Analysis;

// ----------------------------------------------------------------------------
// Load Database
// ----------------------------------------------------------------------------
AB.LoadDatabase("C:\\Amibroker\\FastTrack");

// ----------------------------------------------------------------------------
// Automatic Analysis Input and Export Information
// ----------------------------------------------------------------------------
AFL_Directory = "C:\\Amibroker\\AFL\\";                  // Location of AFL
AFL_ExploreFileName = "0_DataExport.afl";                // AFL program to get
the data to be exported
AFL_ExploreFile = AFL_Directory + AFL_ExploreFileName;   // Name of the above
program with it's path included

Export_Directory = "C:\\Amibroker\\Temp\\";              // Location where
Exported data will be saved
ExportFileName = "MyCsvFile.csv";                        // Name of export file
ExportFile = Export_Directory + ExportFileName;          // Name of above export
file with its path included

// ----------------------------------------------------------------------------
// Setup Exploration using info defined above
// ----------------------------------------------------------------------------
AA.LoadFormula( AFL_ExploreFile );

// Use the following to tell Amibroker what to Include/Exclude and what dates to
use
//
// "index", "favorite", "market", "group", "sector", "index", "watchlist"
// 0 = include; 1 = exclude
// 0 = all stocks, 1 = current stock, 2 = use filter
// 0 = all quotes, 1 = n last quotes, 2 = n last days, 3 = from-to date
//

// Set Filters
AA.ClearFilters();
// AA.Filter(0,"favorite") = 1;   // Try this to load a long ticker which is
favorites ^rut
AA.Filter(0,"watchlist") = 9;     // 0 = Include; "watchlist" 57 contains the
SP500 component stocks
AA.ApplyTo = 2;                   // 0 = all stocks, 1 = current stock, 2 = use
filter

// Set Dates
AA.RangeMode = 3;                    // 0 = all quotes, 1 = n last quotes, 2 = n
last days, 3 = from-to date
//AA.RangeN = 5000;
AA.RangeFromDate = "12/31/2002";
AA.RangeToDate = "12/31/2099";

// ----------------------------------------------------------------------------
// Run exploration, export exploration to csv file
// ----------------------------------------------------------------------------
{AA.Explore();}

{AA.Export( ExportFile );


AB.SaveDatabase();

AB.RefreshAll();}

//AA.ShowWindow(0);                     // 0 = all stocks, 1 = current stock, 2
= use filter

// The End
//
--------------------------------------------------------------------------------\
--------------------------

#144202 From: Alan <alan@...>
Date: Sun Nov 22, 2009 8:32 pm
Subject: Re: Re=Days since DMI crossover
alannortham
Offline Offline
Send Email Send Email
 
Alan wrote:
>
>
> Hi Anthony:
>
> Edited ---
>
> Thank you for your interest in helping me with my problem.  I want to
> either do a Scan or an Exploration that will generate a table of
> stocks where the negative DMI has crossed above the positive DMI and
> show how many days ago the crossover took place.    I only want to
> show the last crossing.  In other words if  the positive DMI
> re-crosses above the negative DMI I do not want it included.  i want
> to find the latest signal where the negative DMI has crossed above the
> positive DMI and how many days ago the signal occurred.  I am using a
> Filtered list that contains the 100 stocks comprising the QQQQ's which
> I have previously submitted to the forum as an attachment.
>
> Regards,
> Alan
>
>
> Anthony Faragasso wrote:
>
>> Hi Alan,
>>
>> Please post your rules again....I will revert with possible solution..
>>
>> Anthony
>>
>>
>> ----- Original Message -----
>> From: "Alan" <alan@...>
>> To: <amibroker@yahoogroups.com>
>> Sent: Sunday, November 22, 2009 9:29 AM
>> Subject: Re: [amibroker] Re=Days since DMI crossover
>>
>>
>>
>>> Hi soni67c:
>>>
>>> Thanks for the code. I tried it and here is a snippit of the results
>>> after a scan:
>>>
>>> Ticker Trade Date Close
>>> AAPL Sell 10/28/2009 192.4
>>> AAPL Buy 11/5/2009 194.03
>>> AAPL Sell 11/20/2009 199.92
>>> ADBE Sell 10/22/2009 35.17
>>>
>>>
>>> This table shows a sell signal on 10/28/09 while MDI is still positive,
>>> a buy signal on 11/05 when on the stock chart is shows a buy signal on
>>> 11/04, and the table shows a sell signal on 11/20/09 again while MDI is
>>> still positive. So I must not be doing something right. I am using a
>>> filter list of the QQQQ's and Scan set for n=30. Any ideas why I am
>>> getting these results?
>>>
>>> Regards,
>>> Alan
>>>
>>> soni67c wrote:
>>>
>>>> Hello Alan,
>>>> Check this formula...this is what you want :).
>>>>
>>>> Range = Param(" +DI - D range", 10, 5, 30,1 );
>>>> Plot(PDI(Range),"",5,1);
>>>> Plot(MDI(Range),"",4,1);
>>>> Plot(ADX(Range),"",13,1);
>>>> Buy = Cross(PDI(Range), MDI(Range));
>>>> Sell = Cross(MDI(Range), PDI(Range));
>>>> PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,20,0);
>>>> PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,20,0);
>>>> bars=SelectedValue(Min( BarsSince( Cross(PDI(Range) , MDI(Range) )),
>>>> BarsSince( Cross( MDI(Range), PDI(Range))) ));
>>>> prevclose=Ref(Close,-bars);
>>>> Com=EncodeColor(colorTan)+("\n\nCurrently the +DMI ("+Range+") is "+
>>>> WriteIf(PDI(Range) > MDI(Range),"bullish","bearish")+", and it crossed "+
>>>> WriteIf(PDI(Range) > MDI(Range),"above","below")+" -DMI ("+Range+")
>>>> ."+"\n"+EncodeColor(colorAqua)+
>>>> WriteVal( Min( BarsSince( Cross( PDI(Range), MDI(Range) )), BarsSince(
>>>> Cross( MDI(Range), PDI(Range)))), 0.0)+
>>>> " period(s) ago.")+EncodeColor(colorTan)+
>>>> Com=("\n\nSince the +DMI crossed -DMI, "+Name()+ "'s price has :
>>>> ")+EncodeColor(colorGold)+"\n"+
>>>> WriteIf(Close>prevclose,"increased %","decreased
>>>> %")+WriteVal(100*(Close-prevclose)/prevclose)+
>>>> EncodeColor(colorTan)+Com=("\n\nAnd has ranged from a high of "+
>>>> WriteVal(HHV(High,bars+1),6.2)+" to a low of
>>>> "+WriteVal(LLV(Low,bars+1),6.2));
>>>> Title = EncodeColor(colorWhite)+ "ABS3" + " - " + Name() +
>>>> EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
>>>> " - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+"
>>>> "+"Hi-"+H+" "+"Lo-"+L+" "+
>>>> "Cl-"+C+" "+ "Vol= "+ WriteVal(V)+ Com;
>>>>
>>>> Thank you
>>>>
>>>>
>>>>
>>>>
>>>> __________ Information from ESET NOD32 Antivirus, version of virus
>>>> signature database 4627 (20091121) __________
>>>>
>>>> The message was checked by ESET NOD32 Antivirus.
>>>>
>>>> http://www.eset.com
>>>>
>>> ------------------------------------
>>>
>>> **** IMPORTANT PLEASE READ ****
>>> This group is for the discussion between users only.
>>> This is *NOT* technical support channel.
>>>
>>> TO GET TECHNICAL SUPPORT send an e-mail directly to
>>> SUPPORT {at} amibroker.com
>>>
>>> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>>> http://www.amibroker.com/feedback/
>>> (submissions sent via other channels won't be considered)
>>>
>>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>>> http://www.amibroker.com/devlog/
>>>
>>> Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>
>>
>>
>> ------------------------------------
>>
>> **** IMPORTANT PLEASE READ ****
>> This group is for the discussion between users only.
>> This is *NOT* technical support channel.
>>
>> TO GET TECHNICAL SUPPORT send an e-mail directly to
>> SUPPORT {at} amibroker.com
>>
>> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>> http://www.amibroker.com/feedback/
>> (submissions sent via other channels won't be considered)
>>
>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> http://www.amibroker.com/devlog/
>>
>> Yahoo! Groups Links
>>
>>
>>
>>
>> __________ Information from ESET NOD32 Antivirus, version of virus signature
database 4627 (20091121) __________
>>
>> The message was checked by ESET NOD32 Antivirus.
>>
>> http://www.eset.com
>>
>>
>>
>>
>>
>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4628 (20091122) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com

#144201 From: Alan <alan@...>
Date: Sun Nov 22, 2009 8:03 pm
Subject: Re: Re=Days since DMI crossover
alannortham
Offline Offline
Send Email Send Email
 
Hi Anthony:

Thank you for your interest in helping me with my problem.  I want to either do a Scan or an Exploration that will generate a table of stocks where the negative DMI has crossed above the positive DMI and show how many days ago the crossover took place.  I am using a Filtered list that contains the 100 stocks comprising the QQQQ's which I have previously submitted to the forum as an attachment.

Regards,
Alan


Anthony Faragasso wrote:
Hi Alan,
Please post your rules again....I will revert with possible solution..
Anthony
----- Original Message ----- From: "Alan" <alan@...>
To: <amibroker@yahoogroups.com>
Sent: Sunday, November 22, 2009 9:29 AM
Subject: Re: [amibroker] Re=Days since DMI crossover
Hi soni67c:
Thanks for the code. I tried it and here is a snippit of the results
after a scan:
Ticker Trade Date Close
AAPL Sell 10/28/2009 192.4
AAPL Buy 11/5/2009 194.03
AAPL Sell 11/20/2009 199.92
ADBE Sell 10/22/2009 35.17
This table shows a sell signal on 10/28/09 while MDI is still positive,
a buy signal on 11/05 when on the stock chart is shows a buy signal on
11/04, and the table shows a sell signal on 11/20/09 again while MDI is
still positive. So I must not be doing something right. I am using a
filter list of the QQQQ's and Scan set for n=30. Any ideas why I am
getting these results?
Regards,
Alan
soni67c wrote:
Hello Alan,
Check this formula...this is what you want :).
Range = Param(" +DI - D range", 10, 5, 30,1 );
Plot(PDI(Range),"",5,1);
Plot(MDI(Range),"",4,1);
Plot(ADX(Range),"",13,1);
Buy = Cross(PDI(Range), MDI(Range));
Sell = Cross(MDI(Range), PDI(Range));
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,20,0);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,20,0);
bars=SelectedValue(Min( BarsSince( Cross(PDI(Range) , MDI(Range) )),
BarsSince( Cross( MDI(Range), PDI(Range))) ));
prevclose=Ref(Close,-bars);
Com=EncodeColor(colorTan)+("\n\nCurrently the +DMI ("+Range+") is "+
WriteIf(PDI(Range) > MDI(Range),"bullish","bearish")+", and it crossed "+
WriteIf(PDI(Range) > MDI(Range),"above","below")+" -DMI ("+Range+")
."+"\n"+EncodeColor(colorAqua)+
WriteVal( Min( BarsSince( Cross( PDI(Range), MDI(Range) )), BarsSince(
Cross( MDI(Range), PDI(Range)))), 0.0)+
" period(s) ago.")+EncodeColor(colorTan)+
Com=("\n\nSince the +DMI crossed -DMI, "+Name()+ "'s price has :
")+EncodeColor(colorGold)+"\n"+
WriteIf(Close>prevclose,"increased %","decreased
%")+WriteVal(100*(Close-prevclose)/prevclose)+
EncodeColor(colorTan)+Com=("\n\nAnd has ranged from a high of "+
WriteVal(HHV(High,bars+1),6.2)+" to a low of
"+WriteVal(LLV(Low,bars+1),6.2));
Title = EncodeColor(colorWhite)+ "ABS3" + " - " + Name() +
EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+"
"+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+ Com;
Thank you
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4627 (20091121) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links

------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
amibroker-digest@yahoogroups.com amibroker-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4627 (20091121) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com


#144200 From: "bistrader" <bistrader@...>
Date: Sun Nov 22, 2009 7:15 pm
Subject: Re: HOW TO CREATE CSV FILE WITHIN AFL OF EXPLORATION
bistrader
Offline Offline
Send Email Send Email
 
Mike and Herman - Thanks.  I understand.  I have some work to do and will do it.

--- In amibroker@yahoogroups.com, "Mike" <sfclimbers@...> wrote:
>
>
> Herman's code would work just as well for an exploration as for any
> other purpose. If you cared to, you could remove the file opening
> closing from my earlier example and simply call his function from the
> loop provided.
>
> e.g.
>
>     for (i = firstBar; i <= lastBar; i++) {
>        if (Filter[i]) {
>           // Make sure output matches same order as AddColumn statements.
>           AddLineToFile(myCSVFile, symbol + "," + DateTimeToStr(dates[i])
> + "," + Close[i] + "\n");
>        }
>     }
>
>
> However, that would be inefficient for any exploration that spanned more
> than a single bar since it would mean repeated opening and closing of
> the file for each bar per symbol, as opposed to just once per symbol.
>
> Similarly, the error handling is different. In the example I posted, if
> the file failed to open nothing was written. Using Herman's code, a
> second attempt would be made, overwriting any existing data. It's up to
> your intended usage to determine which would be more appropriate.
>
> If opting to use Herman's function, I would suggest adding a 3rd
> argument for the mode in which the file is to be opened such that any
> existing contents can be overwritten when first writing the header (i.e.
> using "w" instead of "a").
>
> e.g.
>
> if (Status("stocknum") == 0) {
>     // Make sure header matches same order as AddColumn statements.
>     AddLineToFile(myCSVFile, "Ticker,Date/Time,Close\n", "w");
> }
>
>
> Mike
>
>
> --- In amibroker@yahoogroups.com, "bistrader" <bistrader@> wrote:
> >
> > Herman's code allows one to write a txt message. Correct? I can not
> use it to write the columns of an exploration such as PositionScore and
> the like, can I?
> >
> > --- In amibroker@yahoogroups.com, Mark Hike markhike@ wrote:
> > >
> > > *There's more than one way to skin a cat ;-)
> > > I generally use JScript along with AFL to export the
> scan/exploration
> > > results because I am familiar with both. (In addition I also use
> AutoIt3
> > > script to automate the JScript :-))
> > > But I like Herman's solution, simple and elegant.
> > >
> > > - Mark
> > >
> > > *
> > > On Thu, Nov 19, 2009 at 6:58 PM, Herman psytek@ wrote:
> > >
> > > >
> > > >
> > > > I don't know what your problem is. Did you try using the
> AddLineToFile()
> > > > function I posted, it is about as simple as it can get. I create
> files from
> > > > explorations all the time. It is much simpler than exporting,
> importing,
> > > > file parsing, using jscript, using OLE, etc. You can save directly
> to an afl
> > > > file that is used in other code as an include file. One step,
> without any
> > > > user involvement, to do everything. Give a simple explanation and
> tell us
> > > > the minimum you need to know to get under way. I think you are
> making it
> > > > more complex than it is.
> > > >
> > > > best regards,
> > > > herman
> > > >
> > > > bistrader wrote:
> > > >
> > > > Mike,
> > > >
> > > > I know how to do manually: do an Exploration and then follow with
> Export. Yet, I want to control within afl. I want afl to put or create
> the exploration in csv file. I did read Barry Scarborough's Export EOD
> doc and afl. This is different. I saw Mike's comments about OLE and
> yours about OLE/js. Have written some very simple js to control running
> afls. Actually, I got an example from a friend of mine and simply cut
> and paste it to do what I need. So, I have "some" knowledge about js.
> Enough to read and understand it. In any case, if you or someone has a
> simple example than this would be great. I have also ready Harry's
> comments and tried using fopen and the like. Not giving up. Will keep at
> it, but if someone has example of exporting exploration then maybe I
> will get an "ahh, that is what I am doing wrong" moment. Thanks.
> > > >
> > > > --- In amibroker@yahoogroups.com, "Mike" <sfclimbers@>
> <sfclimbers@> wrote:
> > > >
> > > >
> > > > Bert,
> > > >
> > > > Are you still looking for an answer to this? If all you want to do
> is to save your exploration results as a .csv file, then do as was
> suggested in an earlier reply:
> > > >
> > > > Click on drop arrow of AA Window "File" button, select
> "Export...", choose the location on disk that you want to save to.
> > > >
> > > > The above will give you a .csv file of your results. If you want
> to automate the process, then do as one of the other replies suggested;
> use OLE to drive and export the exploration (e.g. from JScript).
> > > >
> > > > Mike
> > > >
> > > > --- In amibroker@yahoogroups.com, "bistrader" <bistrader@> wrote:
> > > >
> > > >
> > > > Howard, I did read documentation. Could not find example of
> writing exploration in documentation, was having problems and thus the
> posting here.
> > > >
> > > > Bert
> > > >
> > > > --- In amibroker@yahoogroups.com, Howard B <howardbandy@> wrote:
> > > >
> > > >
> > > > Hi Bis --
> > > >
> > > > The documentation explains how to write data to disk files from
> within AFL.
> > > >
> > > > You will need a sequence of:
> > > > fopen -- one time to establish the file
> > > > a loop that formats the data the way you want it, then calls fputs
> for each
> > > > bar
> > > > fclose -- one time to close the file and finalize the write.
> > > >
> > > > Thanks,
> > > > Howard
> > > >
> > > >
> > > > On Wed, Nov 18, 2009 at 9:17 AM, bistrader <bistrader@> wrote:
> > > >
> > > >
> > > >
> > > > I would like to create a csv file of an afls' exploration. Does
> anyone have
> > > > an example?
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ------------------------------------
> > > >
> > > > **** IMPORTANT PLEASE READ ****
> > > > This group is for the discussion between users only.
> > > > This is *NOT* technical support channel.
> > > >
> > > > TO GET TECHNICAL SUPPORT send an e-mail directly to
> > > > SUPPORT {at} amibroker.com
> > > >
> > > >
> > > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER
> athttp://www.amibroker.com/feedback/
> > > > (submissions sent via other channels won't be considered)
> > > >
> > > > For NEW RELEASE ANNOUNCEMENTS and other news always check
> DEVLOG:http://www.amibroker.com/devlog/
> > > >
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
>

#144199 From: Panos Boufardeas <panosbouf@...>
Date: Sun Nov 22, 2009 6:18 pm
Subject: need a loop
blaxaki
Offline Offline
Send Email Send Email
 

Hi
I would like to buy every 10 pips, in forex  lets say 
 
tickzize = 0.0001
buy =0;
TenTicks = 0.0010
Iif (lastvalue(close == TenTicks), BUY, false);
 
How can I write this ?

#144198 From: ram vel <rvlv@...>
Date: Sun Nov 22, 2009 6:01 pm
Subject: Re: REQUIRED DIVERGENCE PLOT(MARK) ON THIS INDICATOR
rvlv
Offline Offline
Send Email Send Email
 
Hi reinsley
 
Thanks a lot
The codes are a good help
rvlv

--- On Sun, 11/22/09, reinsley <reinsley@...> wrote:

From: reinsley <reinsley@...>
Subject: Re: [amibroker] REQUIRED DIVERGENCE PLOT(MARK) ON THIS INDICATOR
To: amibroker@yahoogroups.com
Date: Sunday, November 22, 2009, 10:31 AM


Hi,

Please find two formulas to plot divergences you could adapt.
For a visual check between price and macd.



NB : Capital letters in a post means : to shout at sb


Best regards



// test divergence

// with linearray
// to draw a divergence line on price
// http://www.amibroker.com/guide/afl/afl_view.php?id=250
// adapted by reinsley

y2t=LastValue(Trough(L,0.5,2))-4;
//_TRACE("y2t = "+y2t);
y1t=LastValue(Trough(L,0.5,1))-4;
//_TRACE("y1t = "+y1t);
x2t=BarCount - 1 - LastValue(TroughBars(L,0.5,2));
//_TRACE("x2t = "+x2t);
x1t=BarCount - 1 - LastValue(TroughBars(L,0.5,1));
//_TRACE("x1t = "+x1t);
LineLo = LineArray( x2t, y2t, x1t, y1t, 0 );


// a = ( low2 - low1 ) / ( bars2 - bars1 )
pat = ( y2t - y1t ) / ( x2t - x1t );
//_TRACE("slope price trough = "+pat);

DivColorLo=IIf(pat>=0,27,32);

Plot(C, "Cl", colorBlack, styleCandle);
Plot( LineLo, "TLlo", DivColorLo,styleLine+styleDots+styleThick);
//_TRACE("BC = "+BarCount);


_SECTION_BEGIN("ZIG - Zig");
P = ParamField( "Price field" );
change = Param("% change",0.5,0.1,25,0.1);
Plot( Zig(P, change), _DEFAULT_NAME(), ParamColor( "Color", colorCycle
), ParamStyle("Style") );
_SECTION_END();

y2p=LastValue(Peak(H,0.5,2))+4;
//_TRACE("y2p = "+y2p);
y1p=LastValue(Peak(H,0.5,1))+4;
//_TRACE("y1p = "+y1p);
x2p=BarCount - 1 - LastValue(PeakBars(H,0.5,2));
//_TRACE("x2p = "+x2p);
x1p=BarCount - 1 - LastValue(PeakBars(H,0.5,1));
//_TRACE("x1p = "+x1p);
LineHi = LineArray( x2p, y2p, x1p, y1p, 0 );


// a = ( low2 - low1 ) / ( bars2 - bars1 ) // price a (slope) peak
pap = ( y2p - y1p ) / ( x2p - x1p );
//_TRACE("slope price = "+pap);

DivColorHi=IIf(pap>=0,27,32);

Plot( LineHi, "TLhi", DivColorHi,styleLine+styleDots);


---------------------------------------------------------


//MACD fast no cross 10 UT
//v 1.1
//to find the no cross signal
// adaptation by reinsley

/////////////////Plot Price//////////////////////
_N( Title = "MACD fast no cross 10 UT - " + StrFormat( "{{NAME}} -
{{INTERVAL}} {{DATE}} " ) );
/////////////////////////////////////////////////


r1 = Param( "Fast avg", 5, 2, 200, 1 );
r2 = Param( "Slow avg", 10, 2, 200, 1 );
r3 = Param( "Signal avg", 3, 2, 200, 1 );

ml = MACD( r1, r2 );
sl = Signal( r1, r2, r3 );
// color macd and signal
MACDcol = IIf( ml > sl, colorGreen, IIf( ml < sl, colorRed, colorGreen ) );
Sigcol = IIf( ml > sl, colorGreen, IIf( ml < sl, colorRed, colorGreen ) );

Plot( ml , StrFormat( _SECTION_NAME() + "(%g,%g)", r1, r2 ), MACDcol,
styleThick );//("MACD style")//| styleNoLabel
Plot( sl , "Signal" + _PARAM_VALUES(), Sigcol   ,  styleDashed
);//ParamStyle( "Signal style" ) );//| styleNoLabel
Plot( mh = ml - sl, "MACD Histogram", ParamColor( "Histogram color",
colorBlack ), styleNoTitle | ParamStyle( "Histogram style",
styleHistogram | styleThick | styleNoLabel, maskHistogram ) );//|
styleNoLabel

_SECTION_BEGIN( "MACD" );
// color enveloppe histo bar
mcol = IIf( mh > Ref( mh, -1 ), IIf( mh > 0, 27, 43 ), IIf( mh > 0, 32,
32 ) );// 43 bright green
//mcol= IIf(mh>Ref(mh,-1),IIf(mh > 0,27,27),IIf(mh > 0,32,32));// 27
green : 32 red
lastbar0 = Ref( mh, 0 ) > Ref( mh, - 1 )AND mh >= 0 ;
lastbar1 = Ref( mh, - 1 ) < Ref( mh, - 2 )AND mh >= 0 ;
lastbar2 = Ref( mh, - 2 ) < Ref( mh, - 3 )AND mh >= 0 ;
lastbar3 = Ref( mh, - 3 ) < Ref( mh, - 4 )AND mh >= 0 ;

signocrossup = IIf( lastbar0 AND lastbar1 AND lastbar2   , 1, 0 );
//color no cross histo bar in white
barcolorup = IIf( signocrossup, 2, 1 );// 2 white

lastbardn0 = Ref( mh, 0 ) < Ref( mh, - 1 )AND mh <= 0 ;
lastbardn1 = Ref( mh, - 1 ) > Ref( mh, - 2 )AND mh <= 0 ;
lastbardn2 = Ref( mh, - 2 ) > Ref( mh, - 3 )AND mh <= 0 ;
lastbardn3 = Ref( mh, - 3 ) > Ref( mh, - 4 )AND mh <= 0 ;

signocrossdown = IIf( lastbardn0 AND lastbardn1 AND lastbardn2   , 1, 0 );
//color no cross histo bar in white
barcolordn = IIf( signocrossdown, 2, 1 );
//color histo bar zero line
//Color=IIf(mh > 0,colorGreen,colorDarkRed);
Color = IIf( mh > Ref( mh, -1 ), IIf( mh > 0, 27, 43 ), IIf( mh > 0, 32,
32 ) );

Graph2BarColor = IIf ( signocrossup, barcolorup, IIf( signocrossdown,
barcolordn, Color ) );

Plot( mh, "MACDHistogram", mcol, 6 | styleNoTitle | 4096 );//32768|
Plot( mh, "MACDHistogram", mcol, 5 | styleNoTitle | 4096 ); //32768|

GraphXSpace = 5;


m11 = MACD( r1, r2 );
percent = Param( "Zigpercnt", 2, 0.1, 5, 0.1 );

x22t = BarCount - 1 - LastValue( TroughBars( C, percent , 2 ) );
x11t = BarCount - 1 - LastValue( TroughBars( C, percent , 1 ) );
y22t = m11[x22t] - 2;
y11t = m11[x11t] - 2;
LineLow = LineArray( x22t, y22t, x11t, y11t, 0 );

// a = ( low2 - low1 ) / ( bars2 - bars1 )
at = ( y22t - y11t ) / ( x22t - x11t );

// color divergence line trough
DivColorTrou = IIf( at >= 0, 27, 32 );

Plot( LineLow, "TLlow", DivColorTrou, styleLine + styleDots );


x22p = BarCount - 1 - LastValue( PeakBars( C, percent , 2 ) );
x11p = BarCount - 1 - LastValue( PeakBars( C, percent , 1 ) );
y22p = m11[x22p] + 2;
y11p = m11[x11p] + 2;
LineHigh = LineArray( x22p, y22p, x11p, y11p, 0 );

// a = ( low2 - low1 ) / ( bars2 - bars1 )
ap = ( y22p - y11p ) / ( x22p - x11p );

// color divergence line peak
DivColorPeak = IIf( ap >= 0, 27, 32 );

Plot( LineHigh, "TLhigh", DivColorPeak, styleLine + styleDots );
_SECTION_END();

//SetChartBkGradientFill( ParamColor("BgTop",
colorLightYellow),ParamColor("BgBottom", colorDarkGrey));
//colorLightGrey//colorCustom10


------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@yahoogroups.com
    amibroker-fullfeatured@yahoogroups.com

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

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



#144197 From: reinsley <reinsley@...>
Date: Sun Nov 22, 2009 4:31 pm
Subject: Re: REQUIRED DIVERGENCE PLOT(MARK) ON THIS INDICATOR
reinsley
Offline Offline
Send Email Send Email
 
Hi,

Please find two formulas to plot divergences you could adapt.
For a visual check between price and macd.



NB : Capital letters in a post means : to shout at sb


Best regards



// test divergence

// with linearray
// to draw a divergence line on price
// http://www.amibroker.com/guide/afl/afl_view.php?id=250
// adapted by reinsley

y2t=LastValue(Trough(L,0.5,2))-4;
//_TRACE("y2t = "+y2t);
y1t=LastValue(Trough(L,0.5,1))-4;
//_TRACE("y1t = "+y1t);
x2t=BarCount - 1 - LastValue(TroughBars(L,0.5,2));
//_TRACE("x2t = "+x2t);
x1t=BarCount - 1 - LastValue(TroughBars(L,0.5,1));
//_TRACE("x1t = "+x1t);
LineLo = LineArray( x2t, y2t, x1t, y1t, 0 );


// a = ( low2 - low1 ) / ( bars2 - bars1 )
pat = ( y2t - y1t ) / ( x2t - x1t );
//_TRACE("slope price trough = "+pat);

DivColorLo=IIf(pat>=0,27,32);

Plot(C, "Cl", colorBlack, styleCandle);
Plot( LineLo, "TLlo", DivColorLo,styleLine+styleDots+styleThick);
//_TRACE("BC = "+BarCount);


_SECTION_BEGIN("ZIG - Zig");
P = ParamField( "Price field" );
change = Param("% change",0.5,0.1,25,0.1);
Plot( Zig(P, change), _DEFAULT_NAME(), ParamColor( "Color", colorCycle
), ParamStyle("Style") );
_SECTION_END();

y2p=LastValue(Peak(H,0.5,2))+4;
//_TRACE("y2p = "+y2p);
y1p=LastValue(Peak(H,0.5,1))+4;
//_TRACE("y1p = "+y1p);
x2p=BarCount - 1 - LastValue(PeakBars(H,0.5,2));
//_TRACE("x2p = "+x2p);
x1p=BarCount - 1 - LastValue(PeakBars(H,0.5,1));
//_TRACE("x1p = "+x1p);
LineHi = LineArray( x2p, y2p, x1p, y1p, 0 );


// a = ( low2 - low1 ) / ( bars2 - bars1 ) // price a (slope) peak
pap = ( y2p - y1p ) / ( x2p - x1p );
//_TRACE("slope price = "+pap);

DivColorHi=IIf(pap>=0,27,32);

Plot( LineHi, "TLhi", DivColorHi,styleLine+styleDots);


---------------------------------------------------------


//MACD fast no cross 10 UT
//v 1.1
//to find the no cross signal
// adaptation by reinsley

/////////////////Plot Price//////////////////////
_N( Title = "MACD fast no cross 10 UT - " + StrFormat( "{{NAME}} -
{{INTERVAL}} {{DATE}} " ) );
/////////////////////////////////////////////////


r1 = Param( "Fast avg", 5, 2, 200, 1 );
r2 = Param( "Slow avg", 10, 2, 200, 1 );
r3 = Param( "Signal avg", 3, 2, 200, 1 );

ml = MACD( r1, r2 );
sl = Signal( r1, r2, r3 );
// color macd and signal
MACDcol = IIf( ml > sl, colorGreen, IIf( ml < sl, colorRed, colorGreen ) );
Sigcol = IIf( ml > sl, colorGreen, IIf( ml < sl, colorRed, colorGreen ) );

Plot( ml , StrFormat( _SECTION_NAME() + "(%g,%g)", r1, r2 ), MACDcol,
styleThick );//("MACD style")//| styleNoLabel
Plot( sl , "Signal" + _PARAM_VALUES(), Sigcol   ,  styleDashed
);//ParamStyle( "Signal style" ) );//| styleNoLabel
Plot( mh = ml - sl, "MACD Histogram", ParamColor( "Histogram color",
colorBlack ), styleNoTitle | ParamStyle( "Histogram style",
styleHistogram | styleThick | styleNoLabel, maskHistogram ) );//|
styleNoLabel

_SECTION_BEGIN( "MACD" );
// color enveloppe histo bar
mcol = IIf( mh > Ref( mh, -1 ), IIf( mh > 0, 27, 43 ), IIf( mh > 0, 32,
32 ) );// 43 bright green
//mcol= IIf(mh>Ref(mh,-1),IIf(mh > 0,27,27),IIf(mh > 0,32,32));// 27
green : 32 red
lastbar0 = Ref( mh, 0 ) > Ref( mh, - 1 )AND mh >= 0 ;
lastbar1 = Ref( mh, - 1 ) < Ref( mh, - 2 )AND mh >= 0 ;
lastbar2 = Ref( mh, - 2 ) < Ref( mh, - 3 )AND mh >= 0 ;
lastbar3 = Ref( mh, - 3 ) < Ref( mh, - 4 )AND mh >= 0 ;

signocrossup = IIf( lastbar0 AND lastbar1 AND lastbar2   , 1, 0 );
//color no cross histo bar in white
barcolorup = IIf( signocrossup, 2, 1 );// 2 white

lastbardn0 = Ref( mh, 0 ) < Ref( mh, - 1 )AND mh <= 0 ;
lastbardn1 = Ref( mh, - 1 ) > Ref( mh, - 2 )AND mh <= 0 ;
lastbardn2 = Ref( mh, - 2 ) > Ref( mh, - 3 )AND mh <= 0 ;
lastbardn3 = Ref( mh, - 3 ) > Ref( mh, - 4 )AND mh <= 0 ;

signocrossdown = IIf( lastbardn0 AND lastbardn1 AND lastbardn2   , 1, 0 );
//color no cross histo bar in white
barcolordn = IIf( signocrossdown, 2, 1 );
//color histo bar zero line
//Color=IIf(mh > 0,colorGreen,colorDarkRed);
Color = IIf( mh > Ref( mh, -1 ), IIf( mh > 0, 27, 43 ), IIf( mh > 0, 32,
32 ) );

Graph2BarColor = IIf ( signocrossup, barcolorup, IIf( signocrossdown,
barcolordn, Color ) );

Plot( mh, "MACDHistogram", mcol, 6 | styleNoTitle | 4096 );//32768|
Plot( mh, "MACDHistogram", mcol, 5 | styleNoTitle | 4096 ); //32768|

GraphXSpace = 5;


m11 = MACD( r1, r2 );
percent = Param( "Zigpercnt", 2, 0.1, 5, 0.1 );

x22t = BarCount - 1 - LastValue( TroughBars( C, percent , 2 ) );
x11t = BarCount - 1 - LastValue( TroughBars( C, percent , 1 ) );
y22t = m11[x22t] - 2;
y11t = m11[x11t] - 2;
LineLow = LineArray( x22t, y22t, x11t, y11t, 0 );

// a = ( low2 - low1 ) / ( bars2 - bars1 )
at = ( y22t - y11t ) / ( x22t - x11t );

// color divergence line trough
DivColorTrou = IIf( at >= 0, 27, 32 );

Plot( LineLow, "TLlow", DivColorTrou, styleLine + styleDots );


x22p = BarCount - 1 - LastValue( PeakBars( C, percent , 2 ) );
x11p = BarCount - 1 - LastValue( PeakBars( C, percent , 1 ) );
y22p = m11[x22p] + 2;
y11p = m11[x11p] + 2;
LineHigh = LineArray( x22p, y22p, x11p, y11p, 0 );

// a = ( low2 - low1 ) / ( bars2 - bars1 )
ap = ( y22p - y11p ) / ( x22p - x11p );

// color divergence line peak
DivColorPeak = IIf( ap >= 0, 27, 32 );

Plot( LineHigh, "TLhigh", DivColorPeak, styleLine + styleDots );
_SECTION_END();

//SetChartBkGradientFill( ParamColor("BgTop",
colorLightYellow),ParamColor("BgBottom", colorDarkGrey));
//colorLightGrey//colorCustom10

#144196 From: "khaleel" <indbears@...>
Date: Sun Nov 22, 2009 3:44 pm
Subject: Re: Shortcut - to change symbol within Favourites List
khaleel_sk
Offline Offline
Send Email Send Email
 
NEXT & PREVIOUS SIBLING SHORTCUTS NOT WORKING AFTER UPGRADING TO Version 5.29
beta. please help

--- In amibroker@yahoogroups.com, "Tomasz Janeczko" <groups@...> wrote:
>
> Yes, go to Tools->Customize, "Keyboard" tab.
> Switch Category to "Symbol" then scroll down the commands list.
> You will find "Next Sibling" and "Previous Sibling" items there.
> Now you can assign your custom key strokes to moving to next/prev symbol
> within given category
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "umrperumal" <umrperumal@...>
> To: <amibroker@yahoogroups.com>
> Sent: Sunday, March 02, 2008 7:22 AM
> Subject: [amibroker] Shortcut - to change symbol within Favourites List
>
>
> >
> > Hi members,
> >
> > I have a small list of scrips in Favourites List. When I use short cut
> > keys "Alt + RightArrow" for changing symbols within favourites,  i get
> > the next symbol in the "All Symbols" list,  and not within favourites
> > list.
> >
> > Is there any shortcut way to change symbols within "Favourites" list?
> >
> > Thanks for your time.
> >
> > UMR Perumal
> >
> >
> >
> > 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> > Yahoo! Groups Links
> >
> >
> >
>

#144195 From: "Anthony Faragasso" <ajf1111@...>
Date: Sun Nov 22, 2009 2:43 pm
Subject: Re: Re=Days since DMI crossover
ajf1111us2000
Offline Offline
Send Email Send Email
 
Hi Alan,

Please post your rules again....I will revert with possible solution..

Anthony


----- Original Message -----
From: "Alan" <alan@...>
To: <amibroker@yahoogroups.com>
Sent: Sunday, November 22, 2009 9:29 AM
Subject: Re: [amibroker] Re=Days since DMI crossover


> Hi soni67c:
>
> Thanks for the code. I tried it and here is a snippit of the results
> after a scan:
>
> Ticker Trade Date Close
> AAPL Sell 10/28/2009 192.4
> AAPL Buy 11/5/2009 194.03
> AAPL Sell 11/20/2009 199.92
> ADBE Sell 10/22/2009 35.17
>
>
> This table shows a sell signal on 10/28/09 while MDI is still positive,
> a buy signal on 11/05 when on the stock chart is shows a buy signal on
> 11/04, and the table shows a sell signal on 11/20/09 again while MDI is
> still positive. So I must not be doing something right. I am using a
> filter list of the QQQQ's and Scan set for n=30. Any ideas why I am
> getting these results?
>
> Regards,
> Alan
>
> soni67c wrote:
>>
>> Hello Alan,
>> Check this formula...this is what you want :).
>>
>> Range = Param(" +DI - D range", 10, 5, 30,1 );
>> Plot(PDI(Range),"",5,1);
>> Plot(MDI(Range),"",4,1);
>> Plot(ADX(Range),"",13,1);
>> Buy = Cross(PDI(Range), MDI(Range));
>> Sell = Cross(MDI(Range), PDI(Range));
>> PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,20,0);
>> PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,20,0);
>> bars=SelectedValue(Min( BarsSince( Cross(PDI(Range) , MDI(Range) )),
>> BarsSince( Cross( MDI(Range), PDI(Range))) ));
>> prevclose=Ref(Close,-bars);
>> Com=EncodeColor(colorTan)+("\n\nCurrently the +DMI ("+Range+") is "+
>> WriteIf(PDI(Range) > MDI(Range),"bullish","bearish")+", and it crossed "+
>> WriteIf(PDI(Range) > MDI(Range),"above","below")+" -DMI ("+Range+")
>> ."+"\n"+EncodeColor(colorAqua)+
>> WriteVal( Min( BarsSince( Cross( PDI(Range), MDI(Range) )), BarsSince(
>> Cross( MDI(Range), PDI(Range)))), 0.0)+
>> " period(s) ago.")+EncodeColor(colorTan)+
>> Com=("\n\nSince the +DMI crossed -DMI, "+Name()+ "'s price has :
>> ")+EncodeColor(colorGold)+"\n"+
>> WriteIf(Close>prevclose,"increased %","decreased
>> %")+WriteVal(100*(Close-prevclose)/prevclose)+
>> EncodeColor(colorTan)+Com=("\n\nAnd has ranged from a high of "+
>> WriteVal(HHV(High,bars+1),6.2)+" to a low of
>> "+WriteVal(LLV(Low,bars+1),6.2));
>> Title = EncodeColor(colorWhite)+ "ABS3" + " - " + Name() +
>> EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
>> " - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+"
>> "+"Hi-"+H+" "+"Lo-"+L+" "+
>> "Cl-"+C+" "+ "Vol= "+ WriteVal(V)+ Com;
>>
>> Thank you
>>
>>
>>
>>
>> __________ Information from ESET NOD32 Antivirus, version of virus
>> signature database 4627 (20091121) __________
>>
>> The message was checked by ESET NOD32 Antivirus.
>>
>> http://www.eset.com
>
>
>
> ------------------------------------
>
> **** IMPORTANT PLEASE READ ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
>
> TO GET TECHNICAL SUPPORT send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> http://www.amibroker.com/feedback/
> (submissions sent via other channels won't be considered)
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> Yahoo! Groups Links
>
>
>

#144194 From: cas soni <soni67c@...>
Date: Sun Nov 22, 2009 2:42 pm
Subject: Re: Re=Days since DMI crossover
soni67c
Offline Offline
Send Email Send Email
 

Hello alan,
Everything is good at my end...i checked / confirmed with charts bar per bar basis..in both scan and exploration mode
* add this for exploration
 
BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
Filter=Buy OR Sell ;
AddColumn
(IIf(Buy,BuyPrice,Null),"Buy Price", 6.2,1,colorGreen,70);
AddColumn
(IIf(Sell,SellPrice,Null),"sell Price", 6.2,1,colorOrange,70);
 
Thank you

--- On Sun, 22/11/09, Alan <alan@...> wrote:

From: Alan <alan@...>
Subject: Re: [amibroker] Re=Days since DMI crossover
To: amibroker@yahoogroups.com
Date: Sunday, 22 November, 2009, 7:59 PM

Hi soni67c:

Thanks for the code. I tried it and here is a snippit of the results
after a scan:

Ticker     Trade     Date     Close    
AAPL     Sell     10/28/2009     192.4    
AAPL     Buy     11/5/2009     194.03    
AAPL     Sell     11/20/2009     199.92    
ADBE     Sell     10/22/2009     35.17    


This table shows a sell signal on 10/28/09 while MDI is still positive,
a buy signal on 11/05 when on the stock chart is shows a buy signal on
11/04, and the table shows a sell signal on 11/20/09 again while MDI is
still positive. So I must not be doing something right. I am using a
filter list of the QQQQ's and Scan set for n=30. Any ideas why I am
getting these results?

Regards,
Alan

soni67c wrote:
>
> Hello Alan,
> Check this formula...this is what you want :).
>
> Range = Param(" +DI - D range", 10, 5, 30,1 );
> Plot(PDI(Range),"",5,1);
> Plot(MDI(Range),"",4,1);
> Plot(ADX(Range),"",13,1);
> Buy = Cross(PDI(Range), MDI(Range));
> Sell = Cross(MDI(Range), PDI(Range));
> PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,20,0);
> PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,20,0);
> bars=SelectedValue(Min( BarsSince( Cross(PDI(Range) , MDI(Range) )),
> BarsSince( Cross( MDI(Range), PDI(Range))) ));
> prevclose=Ref(Close,-bars);
> Com=EncodeColor(colorTan)+("\n\nCurrently the +DMI ("+Range+") is "+
> WriteIf(PDI(Range) > MDI(Range),"bullish","bearish")+", and it crossed "+
> WriteIf(PDI(Range) > MDI(Range),"above","below")+" -DMI ("+Range+")
> ."+"\n"+EncodeColor(colorAqua)+
> WriteVal( Min( BarsSince( Cross( PDI(Range), MDI(Range) )), BarsSince(
> Cross( MDI(Range), PDI(Range)))), 0.0)+
> " period(s) ago.")+EncodeColor(colorTan)+
> Com=("\n\nSince the +DMI crossed -DMI, "+Name()+ "'s price has :
> ")+EncodeColor(colorGold)+"\n"+
> WriteIf(Close>prevclose,"increased %","decreased
> %")+WriteVal(100*(Close-prevclose)/prevclose)+
> EncodeColor(colorTan)+Com=("\n\nAnd has ranged from a high of "+
> WriteVal(HHV(High,bars+1),6.2)+" to a low of
> "+WriteVal(LLV(Low,bars+1),6.2));
> Title = EncodeColor(colorWhite)+ "ABS3" + " - " + Name() +
> EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
> " - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+"
> "+"Hi-"+H+" "+"Lo-"+L+" "+
> "Cl-"+C+" "+ "Vol= "+ WriteVal(V)+ Com;
>
> Thank you
>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4627 (20091121) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com



------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@yahoogroups.com
    amibroker-fullfeatured@yahoogroups.com

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

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



The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.

#144193 From: Alan <alan@...>
Date: Sun Nov 22, 2009 2:29 pm
Subject: Re: Re=Days since DMI crossover
alannortham
Offline Offline
Send Email Send Email
 
Hi soni67c:

Thanks for the code. I tried it and here is a snippit of the results
after a scan:

Ticker  Trade  Date  Close
AAPL  Sell  10/28/2009  192.4
AAPL  Buy  11/5/2009  194.03
AAPL  Sell  11/20/2009  199.92
ADBE  Sell  10/22/2009  35.17


This table shows a sell signal on 10/28/09 while MDI is still positive,
a buy signal on 11/05 when on the stock chart is shows a buy signal on
11/04, and the table shows a sell signal on 11/20/09 again while MDI is
still positive. So I must not be doing something right. I am using a
filter list of the QQQQ's and Scan set for n=30. Any ideas why I am
getting these results?

Regards,
Alan

soni67c wrote:
>
> Hello Alan,
> Check this formula...this is what you want :).
>
> Range = Param(" +DI - D range", 10, 5, 30,1 );
> Plot(PDI(Range),"",5,1);
> Plot(MDI(Range),"",4,1);
> Plot(ADX(Range),"",13,1);
> Buy = Cross(PDI(Range), MDI(Range));
> Sell = Cross(MDI(Range), PDI(Range));
> PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,20,0);
> PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,20,0);
> bars=SelectedValue(Min( BarsSince( Cross(PDI(Range) , MDI(Range) )),
> BarsSince( Cross( MDI(Range), PDI(Range))) ));
> prevclose=Ref(Close,-bars);
> Com=EncodeColor(colorTan)+("\n\nCurrently the +DMI ("+Range+") is "+
> WriteIf(PDI(Range) > MDI(Range),"bullish","bearish")+", and it crossed "+
> WriteIf(PDI(Range) > MDI(Range),"above","below")+" -DMI ("+Range+")
> ."+"\n"+EncodeColor(colorAqua)+
> WriteVal( Min( BarsSince( Cross( PDI(Range), MDI(Range) )), BarsSince(
> Cross( MDI(Range), PDI(Range)))), 0.0)+
> " period(s) ago.")+EncodeColor(colorTan)+
> Com=("\n\nSince the +DMI crossed -DMI, "+Name()+ "'s price has :
> ")+EncodeColor(colorGold)+"\n"+
> WriteIf(Close>prevclose,"increased %","decreased
> %")+WriteVal(100*(Close-prevclose)/prevclose)+
> EncodeColor(colorTan)+Com=("\n\nAnd has ranged from a high of "+
> WriteVal(HHV(High,bars+1),6.2)+" to a low of
> "+WriteVal(LLV(Low,bars+1),6.2));
> Title = EncodeColor(colorWhite)+ "ABS3" + " - " + Name() +
> EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
> " - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+"
> "+"Hi-"+H+" "+"Lo-"+L+" "+
> "Cl-"+C+" "+ "Vol= "+ WriteVal(V)+ Com;
>
> Thank you
>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4627 (20091121) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com

#144192 From: "soni67c" <soni67c@...>
Date: Sun Nov 22, 2009 1:28 pm
Subject: Re=Days since DMI crossover
soni67c
Offline Offline
Send Email Send Email
 
Hello Alan,
Check this formula...this is what you want :).

Range 		 = Param(" +DI - D range", 10, 5, 30,1 );
Plot(PDI(Range),"",5,1);
Plot(MDI(Range),"",4,1);
Plot(ADX(Range),"",13,1);
Buy 		 = Cross(PDI(Range), MDI(Range));
Sell 	 = Cross(MDI(Range), PDI(Range));
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,20,0);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,20,0);
bars=SelectedValue(Min( BarsSince( Cross(PDI(Range) , MDI(Range) )), BarsSince(
Cross( MDI(Range), PDI(Range))) ));
prevclose=Ref(Close,-bars);
Com=EncodeColor(colorTan)+("\n\nCurrently the +DMI ("+Range+") is "+
WriteIf(PDI(Range) > MDI(Range),"bullish","bearish")+", and it crossed "+
WriteIf(PDI(Range) > MDI(Range),"above","below")+" -DMI ("+Range+")
."+"\n"+EncodeColor(colorAqua)+
WriteVal( Min( BarsSince( Cross( PDI(Range), MDI(Range) )), BarsSince( Cross(
MDI(Range), PDI(Range)))), 0.0)+
" period(s) ago.")+EncodeColor(colorTan)+
Com=("\n\nSince the +DMI crossed -DMI, "+Name()+ "'s price has  :
")+EncodeColor(colorGold)+"\n"+
WriteIf(Close>prevclose,"increased %","decreased
%")+WriteVal(100*(Close-prevclose)/prevclose)+
EncodeColor(colorTan)+Com=("\n\nAnd has ranged from a high of "+
WriteVal(HHV(High,bars+1),6.2)+" to a low of "+WriteVal(LLV(Low,bars+1),6.2));
Title = EncodeColor(colorWhite)+ "ABS3" + " - " +  Name()  +
EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
  "  - " + Date() +"   -  "+"\n" +EncodeColor(colorYellow) +"Op-"+O+" 
"+"Hi-"+H+"  "+"Lo-"+L+"  "+
"Cl-"+C+"  "+ "Vol= "+ WriteVal(V)+ Com;

Thank you

#144191 From: "Markus Witzler" <funnybiz@...>
Date: Sun Nov 22, 2009 11:16 am
Subject: Re: Re: Computing and plotting historical portfolio metrics in CBT
bakijahadzis...
Offline Offline
Send Email Send Email
 
Hello again, Mike!
 
Nope, I wanted to code my_equity to get a grasp of how CBT actually works.
 
I´m aware that my_equity is the same as ~~~Equity. I later want to modify my code to test my systems with different versions of my_equity, for instance
 
my_equity = cash position plus profit of all open positions (locked up by a stop).
 
I gues Van Tharp calls this "reduced total equity". I want to explore how testing results change if I change the definition of my_equity.
 
But again, I first need to know where the flaw in my code is. Otherwhise, I have no chance to proceed any further.
 
Thanks
 
Markus
 
 
 
 
----- Original Message -----
From: Mike
Sent: Sunday, November 22, 2009 6:52 AM
Subject: [amibroker] Re: Computing and plotting historical portfolio metrics in CBT

 

Markus,

If all you want is a copy of the ~~~Equity that AmiBroker already calculates for you, then there is no need to do any specialized signal/trade handling.

Just do the following:

SetCustombacktestProc("");

if (Status("action") == actionPortfolio
) {
   bo =
GetBacktesterObject
();
   bo.Backtest();
   
AddToComposite(Foreign("~~~Equity", "C"), "~my_equity", "X", atcFlagDefaults | atcFlagEnableInPortfolio
);
}

Plot(Foreign("~my_equity", "C"), "My Equity", colorBlue, styleLine);

Mike


--- In amibroker@yahoogroups.com, "Markus Witzler" <funnybiz@...> wrote:
>
> Hello,
>
> I want to compute and plot my own equity (labeled my_equity).
>
> In the code below (I skkipped the signal part with buy and sell signal), I wonder why my_equity
>
> - is not being shown in backtester report
>
> - can´t be plotted
>
> - doesn´t show up in exploration
>
> Why is that? If you reauire the rest of the code, please let me know
>
> Thanks
>
> Markus
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> ...<snip >...
>
> for (trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos())
>
> {
>
> trade = bo.findopenpos (sig.symbol);
>
> if (trade)
>
> {
>
> value_all_open_pos=value_all_open_pos + trade.GetPrice(i, "C") * trade.shares;
>
> }
>
>
>
> }
>
> bo.HandleStops(i); // Process programmed stops or applystop at this bar
>
> my_equity [i] = bo.cash + value_all_open_pos;
>
> } // End of for loop over signals at this bar
>
>
> bo.UpdateStats(i, 1); // Update MAE/MFE stats for bar
>
> bo.UpdateStats(i, 2); // Update stats at bar's end
>
> } // End of for loop over bars
>
> bo.PostProcess(); // Do post-processing
>
> AddToComposite(my_equity, "~~~my_equity","x", atcFlagEnableInPortfolio | atcFlagDefaults);
>
> }
>
> PlotForeign("~~~my_equity", "my_equity", colorRed, styleHistogram );
>



__________ Information from ESET Smart Security, version of virus signature database 4627 (20091121) __________

The message was checked by ESET Smart Security.

http://www.eset.com


__________ Information from ESET Smart Security, version of virus signature database 4627 (20091121) __________

The message was checked by ESET Smart Security.

http://www.eset.com

#144190 From: Alan <alan@...>
Date: Sun Nov 22, 2009 8:15 am
Subject: Re: Days since DMI crossover [1 Attachment]
alannortham
Offline Offline
Send Email Send Email
 
I guess I am still confused.  When I do an Exploration over the last 30
days I get the following (I show only a snippit):

Ticker  Date/Time  BUY  SELL  uptrend   downtrend
AAPL  10/30/2009  0  1  78  0
AAPL  11/4/2009  1  0  0  3


What I am confused about is that the last signal from Apple was a buy
signal on 11/4/09.  However the number of days since that signal shows
up under the uptrend column as 0.  There has been 12 trading days since
this last buy signal so why doesn't the uptrend column reflect the
number of days since the last buy signal?

Alan,
P.S.  I guess the Forum program doesn't accept attachments to email as I
do not see the QQQQ list I attached to my last email.


Alan wrote:
> Hi rvlv:
>
> Thanks for your interest in helping me with my problem and for the code.
> I tried the code with a filtered list of the 100 stocks making up the
> QQQQ's (list attached) and here is my results:
>
> Ticker Date/Time BUY SELL uptrend downtrend
> BRCM 11/20/2009 0.00 1.00 8 0
> DELL 11/20/2009 0.00 1.00 9 0
> FWLT 11/20/2009 0.00 1.00 12 0
> INTU 11/20/2009 0.00 1.00 11 0
> LLTC 11/20/2009 0.00 1.00 9 0
> NWSA 11/20/2009 0.00 1.00 11 0
>
> What was immediately confusing to me is that the table shows that there
> has been no buy signal for BRCM (for example) but yet the table shows
> that BRCM has been in an uptrend for 8 days. After studying to code and
> the actual price chart I now understand how to read the table yet it is
> intuitively confusing. I think it would be less confusing if the table
> showed the date of the last buy, put a 1 in the buy column and showed
> how many days have gone by since the buy signal was given. Same with
> sell signals, but that's my opinion. However, the code does give the
> information I am looking for so thanks, and I appreciate the time spent
> helping me.
>
> Regards,
> Alan
>
>
> ram vel wrote:
>
>> Hi Alan
>> please try this code it may help serve your purpose
>>
--------------------------------------------------------------------------------
>> //The following code will return a 1 when the negative DMI crosses
>> above the positive DMI.
>> mdmi =
>> MDI(13);
>> pdmi =
>> PDI(13);
>> NEGdmicrossing =
>> Cross(mdmi,pdmi);
>> POSITIVEdmicrossing =
>> Cross(pdmi,mdmi);* *
>> *Buy*=POSITIVEdmicrossing ;
>> **
>> *Sell* =NEGdmicrossing;
>> BarsSince
>> ( POSITIVEdmicrossing ) ;
>> BarsSince
>> ( NEGdmicrossing ) ;
>> **
>> *Filter*=*Buy* *OR* *Sell*;
>> AddColumn
>> (*Buy*,"BUY",format=1.2);
>> AddColumn
>> (*Sell*,"SELL",format=1.2);
>> AddColumn
>> ((BarsSince( POSITIVEdmicrossing )), "uptrend ",format=1.0);
>> AddColumn
>> ((BarsSince( NEGdmicrossing )), "downtrend ",format=1.0);
>> //- bars since Trading system toolbox reference
>> //SYNTAX BarsSince( ARRAY )
>> //RETURNS ARRAY
>> //function Calculates the number of bars (time periods) that have
>> passed since ARRAY was True (OR 1)
>> //EXAMPLE BarsSince( MACD() < 0 )
>>
--------------------------------------------------------------------------------\
-------------------------------------------------------------------
>> regards
>> rvlv
>> -------------------------------
>>
>> --- On *Sat, 11/21/09, Alan /<alan@...>/* wrote:
>>
>>
>>     From: Alan <alan@...>
>>     Subject: [amibroker] Days since DMI crossover
>>     To: amibroker@yahoogroups.com
>>     Date: Saturday, November 21, 2009, 2:51 PM
>>
>>     The following code will return a 1 when the negative DMI crosses
>>     above
>>     the positive DMI.
>>
>>     mdmi = MDI(13);
>>     pdmi = PDI(13);
>>     dmicrossing = Cross(mdmi,pdmi);
>>
>>     However, what I want to know is how many days have passed since the
>>     negative DMI crossed above the positive DMI. I have looked through
>>     the
>>     AFL formulas for a Days Since Crossing function but did not find one.
>>     Can anyone help me with the code to perform this function?
>>
>>     Thanks,
>>     Alan
>>
>>
>>     ------------------------------------
>>
>>     **** IMPORTANT PLEASE READ ****
>>     This group is for the discussion between users only.
>>     This is *NOT* technical support channel.
>>
>>     TO GET TECHNICAL SUPPORT send an e-mail directly to
>>     SUPPORT {at} amibroker.com
>>
>>     TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>>     http://www.amibroker.com/feedback/
>>     <http://www.amibroker.com/feedback/>
>>     (submissions sent via other channels won't be considered)
>>
>>     For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>>     http://www.amibroker.com/devlog/ <http://www.amibroker.com/devlog/>
>>
>>     Yahoo! Groups Links
>>
>>
>>     (Yahoo! ID required)
>>
>>
>>     amibroker-fullfeatured@yahoogroups.com
>>    
<http://us.mc342.mail.yahoo.com/mc/compose?to=amibroker-fullfeatured@yahoogroups\
.com>
>>
>>
>>
>>
>>
>>
>> __________ Information from ESET NOD32 Antivirus, version of virus
>> signature database 4627 (20091121) __________
>>
>> The message was checked by ESET NOD32 Antivirus.
>>
>> http://www.eset.com
>>
>
>
>
>
> ------------------------------------
>
> **** IMPORTANT PLEASE READ ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
>
> TO GET TECHNICAL SUPPORT send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> http://www.amibroker.com/feedback/
> (submissions sent via other channels won't be considered)
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> Yahoo! Groups Links
>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature
database 4627 (20091121) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
>
>

#144189 From: Alan <alan@...>
Date: Sun Nov 22, 2009 7:37 am
Subject: Re: Days since DMI crossover
alannortham
Offline Offline
Send Email Send Email
 
Hi rvlv:

Thanks for your interest in helping me with my problem and for the code.
I tried the code with a filtered list of the 100 stocks making up the
QQQQ's (list attached) and here is my results:

Ticker Date/Time BUY SELL uptrend downtrend
BRCM 11/20/2009 0.00 1.00 8 0
DELL 11/20/2009 0.00 1.00 9 0
FWLT 11/20/2009 0.00 1.00 12 0
INTU 11/20/2009 0.00 1.00 11 0
LLTC 11/20/2009 0.00 1.00 9 0
NWSA 11/20/2009 0.00 1.00 11 0

What was immediately confusing to me is that the table shows that there
has been no buy signal for BRCM (for example) but yet the table shows
that BRCM has been in an uptrend for 8 days. After studying to code and
the actual price chart I now understand how to read the table yet it is
intuitively confusing. I think it would be less confusing if the table
showed the date of the last buy, put a 1 in the buy column and showed
how many days have gone by since the buy signal was given. Same with
sell signals, but that's my opinion. However, the code does give the
information I am looking for so thanks, and I appreciate the time spent
helping me.

Regards,
Alan


ram vel wrote:
>
> Hi Alan
> please try this code it may help serve your purpose
>
--------------------------------------------------------------------------------
> //The following code will return a 1 when the negative DMI crosses
> above the positive DMI.
> mdmi =
> MDI(13);
> pdmi =
> PDI(13);
> NEGdmicrossing =
> Cross(mdmi,pdmi);
> POSITIVEdmicrossing =
> Cross(pdmi,mdmi);* *
> *Buy*=POSITIVEdmicrossing ;
> **
> *Sell* =NEGdmicrossing;
> BarsSince
> ( POSITIVEdmicrossing ) ;
> BarsSince
> ( NEGdmicrossing ) ;
> **
> *Filter*=*Buy* *OR* *Sell*;
> AddColumn
> (*Buy*,"BUY",format=1.2);
> AddColumn
> (*Sell*,"SELL",format=1.2);
> AddColumn
> ((BarsSince( POSITIVEdmicrossing )), "uptrend ",format=1.0);
> AddColumn
> ((BarsSince( NEGdmicrossing )), "downtrend ",format=1.0);
> //- bars since Trading system toolbox reference
> //SYNTAX BarsSince( ARRAY )
> //RETURNS ARRAY
> //function Calculates the number of bars (time periods) that have
> passed since ARRAY was True (OR 1)
> //EXAMPLE BarsSince( MACD() < 0 )
>
--------------------------------------------------------------------------------\
-------------------------------------------------------------------
> regards
> rvlv
> -------------------------------
>
> --- On *Sat, 11/21/09, Alan /<alan@...>/* wrote:
>
>
>     From: Alan <alan@...>
>     Subject: [amibroker] Days since DMI crossover
>     To: amibroker@yahoogroups.com
>     Date: Saturday, November 21, 2009, 2:51 PM
>
>     The following code will return a 1 when the negative DMI crosses
>     above
>     the positive DMI.
>
>     mdmi = MDI(13);
>     pdmi = PDI(13);
>     dmicrossing = Cross(mdmi,pdmi);
>
>     However, what I want to know is how many days have passed since the
>     negative DMI crossed above the positive DMI. I have looked through
>     the
>     AFL formulas for a Days Since Crossing function but did not find one.
>     Can anyone help me with the code to perform this function?
>
>     Thanks,
>     Alan
>
>
>     ------------------------------------
>
>     **** IMPORTANT PLEASE READ ****
>     This group is for the discussion between users only.
>     This is *NOT* technical support channel.
>
>     TO GET TECHNICAL SUPPORT send an e-mail directly to
>     SUPPORT {at} amibroker.com
>
>     TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>     http://www.amibroker.com/feedback/
>     <http://www.amibroker.com/feedback/>
>     (submissions sent via other channels won't be considered)
>
>     For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>     http://www.amibroker.com/devlog/ <http://www.amibroker.com/devlog/>
>
>     Yahoo! Groups Links
>
>
>     (Yahoo! ID required)
>
>
>     amibroker-fullfeatured@yahoogroups.com
>    
<http://us.mc342.mail.yahoo.com/mc/compose?to=amibroker-fullfeatured@yahoogroups\
.com>
>
>
>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4627 (20091121) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com

1 of 1 File(s)


#144188 From: "Mike" <sfclimbers@...>
Date: Sun Nov 22, 2009 5:52 am
Subject: Re: Computing and plotting historical portfolio metrics in CBT
sfclimbers
Offline Offline
Send Email Send Email
 

Markus,

If all you want is a copy of the ~~~Equity that AmiBroker already calculates for you, then there is no need to do any specialized signal/trade handling.

Just do the following:

SetCustombacktestProc("");

if (Status("action") == actionPortfolio
) {
   bo =
GetBacktesterObject
();
   bo.Backtest();
   
AddToComposite(Foreign("~~~Equity", "C"), "~my_equity", "X", atcFlagDefaults | atcFlagEnableInPortfolio
);
}

Plot(Foreign("~my_equity", "C"), "My Equity", colorBlue, styleLine);

Mike


--- In amibroker@yahoogroups.com, "Markus Witzler" <funnybiz@...> wrote:
>
> Hello,
>
> I want to compute and plot my own equity (labeled my_equity).
>
> In the code below (I skkipped the signal part with buy and sell signal), I wonder why my_equity
>
> - is not being shown in backtester report
>
> - can´t be plotted
>
> - doesn´t show up in exploration
>
> Why is that? If you reauire the rest of the code, please let me know
>
> Thanks
>
> Markus
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> ...<snip >...
>
> for (trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos())
>
> {
>
> trade = bo.findopenpos (sig.symbol);
>
> if (trade)
>
> {
>
> value_all_open_pos=value_all_open_pos + trade.GetPrice(i, "C") * trade.shares;
>
> }
>
>
>
> }
>
> bo.HandleStops(i); // Process programmed stops or applystop at this bar
>
> my_equity [i] = bo.cash + value_all_open_pos;
>
> } // End of for loop over signals at this bar
>
>
> bo.UpdateStats(i, 1); // Update MAE/MFE stats for bar
>
> bo.UpdateStats(i, 2); // Update stats at bar's end
>
> } // End of for loop over bars
>
> bo.PostProcess(); // Do post-processing
>
> AddToComposite(my_equity, "~~~my_equity","x", atcFlagEnableInPortfolio | atcFlagDefaults);
>
> }
>
> PlotForeign("~~~my_equity", "my_equity", colorRed, styleHistogram );
>


Messages 144188 - 144217 of 144217   Newest  |  < Newer  |  Older >  |  Oldest
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help