![]() |
|
| Discuss AmiBroker formula Language at the AmiBroker within the Traderji.com - Discussion forum for Stocks Commodities & Forex; Originally Posted by kuriako Ami doesn't support default values for parameters of user-defined functions/procedures. That ... |
|
|||||||
| Notices |
![]() |
|
|
Thread Tools |
| Sponsored Links |
|
#171
|
|||
|
|||
|
Quote:
BTW, should use IP1 == null and IP2 == null or else Null will be assigned to args IP1 & IP2 irrespective of values passed. Regards, Kalyan. Last edited by kkseal; 12th December 2007 at 09:45 PM. |
| Sponsored Links |
|
#172
|
|||
|
|||
|
Can u please try function with "No parameters passed"
ie: function KMACD() {if(IP1==0.... ........ } Arguments can be passed with universal variables! |
|
#173
|
|||
|
|||
|
Quote:
I had thought of the global variable route as well. Suppose i have an AFL called K_defaults.afl where all the default values are declared/defined. Let's say the defaults for the KMACD are def_fpd = 12 & def_spd = 26. Now i include this file everywhere i want to use the KMACD (a hassle in itself). Even then when i want to use the default values i'll have to use the function call as KMACD(def_fpd, def_spd). So no advantage. I might as well simply use KMACD(12,26) (saving me the first hassle). Anyways, as i said, no big deal. And thanks for your suggestion. Regards, Kalyan. |
|
#174
|
|||
|
|||
|
hi to all,
i m new and i need: today volume is greater than yesterday volume by 20 or 30% to day price is greater than yesterday price i want to create a corelation between price and volume thnx to all for gr8 contribution sharad |
|
#175
|
|||
|
|||
|
Hi all , can someone help me
How do i plot 1) A Sell arrow "when K% Cross down D% and it above 75% level" 2) A buy arrow " when K% Cross up D% and it below 25% level" _SECTION_BEGIN("Slow Stochastic"); /*Slow Stochastic and Trendlines for Indicator Builder, by Dimitris Tsokakis*/ D1=14; MaxGraph=8; ST3=StochK(D1); ST33=StochD(D1); Graph0=ST3; Graph1=ST33; Title=Name()+" - %K="+WriteVal(st3,FORMAT=1.2)+", %D="+ WriteVal(ST33,FORMAT=1.2)+ WriteIf(Cross(st3,st33)," POSITIVE CROSS"," ")+ WriteIf(Cross(ST33,ST3)," NEGATIVE CROSS",""); x = Cum(1); per = 0.1; s1=st33; s11=st33; pS = TroughBars( s1, per, 1 ) == 0; endt= LastValue(ValueWhen( pS, x, 1 )); startt=LastValue(ValueWhen( pS, x, 2 )); dtS =endt-startt; endS = LastValue(ValueWhen( pS, s1, 1 ) ); startS = LastValue( ValueWhen( pS, s1, 2 )); aS = (endS-startS)/dtS; bS = endS; trendlineS = aS * ( x -endt ) + bS; Graph6 = IIf(x>startt-1 AND TRENDLINES>0 AND TRENDLINES<100,trendlineS,-1e10); Graph6Style = 1; Graph6Color = 1; pR = PeakBars( s11, per, 1 ) == 0; endt1= LastValue(ValueWhen( pR, x, 1 )); startt1=LastValue(ValueWhen( pR, x, 2 )); dtR =endt1-startt1; endR = LastValue(ValueWhen( pR, s11, 1 ) ); startR = LastValue( ValueWhen( pR, s11, 2 )); aR = (endR-startR)/dtR; bR = endR; trendlineR = aR * ( x -endt1 ) + bR; Graph7 = IIf(x>startT1-1 AND TRENDLINER>0 AND TRENDLINER<100,trendlineR,-1e10); Graph7Style = 1; Graph7Color = 1; PlotGrid( 75, colorGreen ); PlotGrid( 25, colorGreen ); _SECTION_END(); |
|
#176
|
|||
|
|||
Hi Kalyan i am new the alf progamming so pleasehelp me to write the amiborker formula I want to filter the data condition is below advance price =movingaverage(close,10) decline price =movingaverage(close,10) x=advance price/decline price if x>.75 then conditionl=true if x<.50 then conditionl=false if conditionl=true and rsi(close,8) crosses above 30 then buy on close if rsi(close,8) crosses below 65 then exitlong on close if conditionl=false then exitlong on close Last edited by mishphar; 25th December 2007 at 09:21 AM. |
|
#177
|
|||
|
|||
|
Quote:
Seemingly, what you want is a MA for the UP days & a MA for the DN days. (Pretty much what the RSI does with the momentum, only it doesn't stop there) However this needs confirmation from your side. Regards, Kalyan. Last edited by kkseal; 25th December 2007 at 02:34 PM. |
|
#178
|
|||
|
|||
|
Hi kalyan thnx for quick response
the formula describe in "Trading Secrets of Inner cirlcle" by Andrew Goodwin book which is Market Breadth Filtered 8 day RSI: Rules: 1) Calculate the 10 day simple moving average of the number of advancing issues on the NYSE. This number is available from most quote services, brokers and financial television tickers. A ten day moving average is calculated by adding the last ten days of advances and dividing this sum by 10. 2) Calculate the 10 day simple moving average of the number of declining issues on the NYSE. Follow the same procedure that you did to calculate the 10 day moving average of advances. 12 Trading Secrets of the Inner Circle 3) Divide the 10 day average of advances by the 10 day average of declines. 4) If the value of the division is greater than .75 or 75% then our market breadth filter is considered positive. 5) If the value of the division is less than .50 then our market breadth filter is considered negative. 6) If the breadth filter is positive then buy the S&P 500 contracts on the close of the day when the 8 day RSI crosses from below to above 30. 7) Exit your long position if the 8 day RSI crosses from above to below 65. 8) Also exit your long position if the market breadth filter changes from positive to negative. Results and discussion of the Breadth Filtered 8 day RSI This system adds a trend filter designed to get us out of the trade if market breadth deteriorates while we are in the trade, but the 8 day RSI fails to provide us with an exit. This technological advance allows us to get out of bad trades more quickly than we would if we were trading the 8 day RSI system. Profit factor rises to 4.55 from the 3.29 of the basic system. Our net profit increases by $28,000 and our maximum drawdown shrinks by nearly 65%. This system clearly improves the result of the basic system and gives us a safer way to trade. However, the W/L ratio is still too low at .71. So let us move to the "Market Wizard" version. Treasury Note and Treasury Bill Filtered 8 day RSI: These filters were adapted from a concept discussed by the great S&P trader, Marly Schwartz who was interviewed in the trading book "Market Wizards." Schwartz suggests trading S&P futures when both bonds and short paper are above their moving averages. This model draws on Schwartz's concept, but we have added our own twist. Market Wizard Filter 13 Rules: 1) Each Friday, record the close of the CBOT's ten-year note future. When the Friday close of the ten-year note is greater than its 40 week moving average then the note filter is positive. If Friday is a holiday, use whatever close is the last close of the trading week. 2) Each Friday, record the close of the Treasury bill future. When Friday's closing T'bill future price is greater than its 40 week moving average, then the short paper filter is positive. 3) If the note filter and the bill filter are both positive then the interest rate component is positive. 4) If the note filter and the bill filter are both negative then the interest rate composite is negative. 5) If either the note filter or the bill filter is positive while the other is negative, the last reading of the interest rate composite stays the same. A change in the reading is only possible if both the note and the bill filter are above or below their moving averages simultaneously at Friday's close. 6) If the interest rate composite is bullish, buy on the close of the day when the 8 day RSI crosses from below to above the 40 buy line. 7) Exit your long trade if the 8 day RSI crosses from above to below the 75 sell line. 8) Exit your long trade if the interest rate composite changes from positive to negative even if RSI has not given an exit signal yet. |
|
#179
|
|||
|
|||
|
Mishphar, now that you have everything for the coding try doing it on your own (or else tomorrow you may come across another 'secret' & cry help for the coding)
Look up the following in Ami Help Functions : AdvIssues, DecIssues, Cross Reserved variables : Buy, Sell, Filter Cut out all the fluff (colouring,shapes etc.) and just concentrate on the basic code. Not all that difficult. Regards, Kalyan. |
|
#180
|
|||
|
|||
|
Yes Kalyan u r correct but I am completely new for this programming it is not that I will grasp in one day everything I am trying at my best and reading now all the alf functions so it will take some time just u write the code once then i will try to practice next.
thnx for ur encouraging word. |
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads for: AmiBroker formula Language
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| need help on formula | cmlee | MetaStock | 23 | 8th October 2007 07:55 PM |
| Metastock ,Metatrader & Amibroker indicator formula | saji oommen | MetaStock | 0 | 4th June 2006 06:35 PM |
| Metastock language help | Ropewalker | MetaStock | 4 | 1st November 2005 09:16 PM |
| TradeStation & MetaStock Formula Language | bikertrader | MetaStock | 4 | 10th December 2004 01:50 PM |
Indemnity, Disclaimer & Disclosure
Notice:
• By visiting Traderji.com you indicate your acceptance of our Forum
Rules Disclaimer & Disclosure and indemnify Traderji.com, its
associates and related parties of all claims howsoever resulting from
the usage of the forum.
• Disclaimer: Trading or investing in stocks & commodities
is a high risk activity. Any action you choose to take in the markets
is totally your own responsibility. Traderji.com will not be liable for
any, direct or indirect, consequential or incidental damages or loss arising out of the use of this information.
• Disclosure: The information in this forum is neither an offer to sell nor solicitation to buy any of the securities mentioned herein.
The writers may or may not be trading in the securities mentioned.
• All names or products mentioned are trademarks or registered trademarks of their respective owners.
General Content Disclaimer Notice:
In light of our policy of encouraging candid, open exchanges of views and the rapid distribution of information originating from many sources, Traderji.com cannot determine the accuracy of information that may be uploaded to the forum. Opinions, advice and all other information expressed by participants in discussions are those of the author. You rely on such information at your own risk. You are urged to seek professional advice for specific, individual situations and not rely solely on advice or opinions given in the discussions. Since Traderji.com is an open and free discussion forum, any comments made by members of this forum in their posts reflect their own views and not of the owner or administrator of Traderji.com. Thus the owner/administrator indemnify themselves of all claims whatsoever and will not be liable or responsible for any members comments/views in this forum Traderji.com. If you find any objectionable or offensive posts made by members of this forum which you would like to bring to our notice for removal then please Contact Us.