![]() |
|
| Discuss Help Needed to Create AFL For Crossover Moving Average. at the AmiBroker within the Traderji.com - Discussion forum for Stocks Commodities & Forex; Dear Experts, I like to get AFL for Below Condition. Please Help Me. Condition : ... |
|
|||||||
| Notices |
![]() |
|
|
Thread Tools |
| Sponsored Links |
|
#1
|
|||
|
|||
|
Dear Experts,
I like to get AFL for Below Condition. Please Help Me. Condition : Buy Signal:- i) I want create Buy Signal "When Moving average 50 Crossover the price & After the Price go above ten points" [ Please Assume If Nifty Price is 3600. Movingaverage 50 is now crossover the price=3600, after then Nifty go up to 3610 now I want show Buy Signal in 3610. ] I USE HERE ONLY ONE MOVING AVERAGE. ii) I want create Sell Signal "When Moving average 50 Crossover the price & After the Price go Below ten points" [ Please Assume If Nifty Price is 3600. Movingaverage 50 is now crossover the price=3600, after then Nifty go Down to 3590 now I want show Sell Signal in 3590. ] I am waiting for yours reply. Regards V.V. |
| Sponsored Links |
|
#2
|
|||
|
|||
|
Since this seems to be for intraday and Nifty only, just put the 50 MA on the chart and wait for the crossover. If you want it for scanning multiple stocks then you need to scan with this
x = (C+10) > MA(C,50); Buy = x; |
|
#3
|
|||
|
|||
|
// Identify the price when the MA crosses above the price.
crossOverValue = ValueWhen( Cross( MA(C, 50), C), C, 1); // Trigger the buy-signal when the price crosses above the crossOverValue + 10 points. buySignal = Cross( C, crossOverValue + 10 ); // Trigger the Buy signal when the condition is met. Buy = buySignal; // Further code can be written to avoid whip-saws of the buy-signal. |
|
#4
|
|||
|
|||
|
Quote:
Thankyou for your Help. I tried this formula. Please See the Attachment file. Here I used 10 MA . When this Movingaverage Crossover the price at the same time that price go to above 10 points then I like to show Buy signal at the same time after i got Buy signal When this MA Crossover the Price Below at the same time that price go to below 10 Points then here I want to show Cover Signal. Please Can help to create AFL For this Method . Long :- ====== 1) MA Crossover Above the Price (AND) After Price goto + 10 Points ===> Buy Signal 2) After I got Buy signal Price + 20 Points (Profit Booking) ===> cover Signal Stoploss (Exit Long) :- ================= 1st condition true but second condition false then I should show Long Cover (Stoploss) Signal. Condition : MA Crossover Below the Price -10 Points === Exit Long Signal Short :- ====== 1) MA Crossover Below the Price (AND) Price goto -10 Points ===> Sell Signal 2) After I got sell signal Price + 20 Points (profit Booking) ===> cover Signal Stoploss (Exit Short) :- ================= 1st condition true but second condition false then I should show Short Cover (Stoploss) Signal. Condition : MA Crossover Above the Price (AND) Price goto + 10 Points ===> Exit Short Signal ================================================== ======= I Used This AFL : _SECTION_BEGIN("Test"); Title = Name() + " " + Date() + " Open:" + O +"," + " High: " + H +"," + " Low: " + L+"," + EncodeColor( colorBlue ) + " Close: " + C+"," + EncodeColor( colorBlack ) + " Volume: " + V ;//+ EncodeColor( colorBlue )+ "\n" + EncodeColor(colorDarkGreen) + WriteVal (XR, format=1.2 ) + " Price Required for EMA Crossover"; Plot(EMA( Close,10), "", colorRed ); // Identify the price when the MA crosses above the price. crossOverValue = ValueWhen( Cross( MA(C, 10), C), C, 1); // Trigger the buy-signal when the price crosses above the crossOverValue + 10 points. buySignal = Cross( C, crossOverValue + 10 ); // Trigger the Buy signal when the condition is met. Buy = buySignal; shape = Buy * shapeUpArrow ; PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) ); // Further code can be written to avoid whip-saws of the buy-signal. _SECTION_END(); ================================================== ======== Kindly help me. Regards V.V. |
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
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.