![]() |
|
| Discuss Bar Delay in Trading System at the MetaStock within the Traderji.com - Discussion forum for Stocks Commodities & Forex; I´m putting together a trading system to generate buy and sell signals (only operating long) ... |
|
|||||||
| Notices |
![]() |
|
|
Thread Tools |
| Sponsored Links |
|
#1
|
|||
|
|||
|
I´m putting together a trading system to generate buy and sell signals (only operating long) and I would appreciate if someone could help me with Metastock language.
How can I tell Metastock to buy or sell only if the following bar is not opposite to the first one? Ex: bar 1: buy signal bar 2: buy signal bar 3: execute buy bar 1: buy signal bar 2: sell signal bar 3: ignore signal Thanks a lot for your help!!! Traderbrazil |
|
#2
|
|||
|
|||
|
Hello SNIGDHA!!
Thanks for your reply although I´m not really familiar with MS language yet. Below is the formula I'm using for buy signal: C>Fml("Ehlers Distant Coefficient Filter") If it´s not too much trouble for you please write down how I could use the if function attached to it with the delay (3rd bar buy if 2nd bar is not sell) thanks a lot! Traderbrazil |
|
#3
|
|||
|
|||
|
Quote:
Name : Long Enter Condition: a:= Fml("Ehlers Distant Coefficient Filter"); b:= Sum( C > a,2) = 2; d:= Your Exit condition {Say, C < a}; f:= If(BarsSince(b) < BarsSince(d),1,0); f > Ref(F,-1); Name: Long Exit Condition: a:= Fml("Ehlers Distant Coefficient Filter"); b:= Sum( C > a,2) = 2; d:= Your Exit condition {Say, C < a}; f:= If(BarsSince(b) > BarsSince(d),1,0); f > Ref(F,-1); Name : Short Enter Condition: a:= Fml("Ehlers Distant Coefficient Filter"); b:= Sum( C < a,2) = 2; d:= Your Exit condition {Say, C > a}; f:= If(BarsSince(b) < BarsSince(d),1,0); f > Ref(F,-1); Name: Short Exit Condition: Condition: a:= Fml("Ehlers Distant Coefficient Filter"); b:= Sum( C < a,2) = 2; d:= Your Exit condition {Say, C > a}; f:= If(BarsSince(b) > BarsSince(d),1,0); f > Ref(F,-1); Regards. Last edited by oxusmorouz; 8th July 2007 at 04:02 PM. |
|
#4
|
|||
|
|||
|
Hello Oxusmorouz!
Thanks a lot for your input! I´ll try it out and let you know how it worked.. best regards, traderbrazil |
|
#5
|
|||
|
|||
|
Hello oxusmorouz,
I find your answer very brilliant to the querry of traderbrazil. I am new to metastock and shall be very grateful to know the answers of my innocent looking questions; ============================ po:=ref(o,-1); pl:=ref(l,-1); ph:=ref(h.-1); pc:=ref(c,-1); {fml1} If(po>=pc,po+(po-pl),po-(ph-po)); {fml2} if(po>pc,ph, if(po<pc,pl,po)); ================================ suppose signals are: fml1>fml2 {buy} fml1<fml2 {sell} =============================== Que-1: In the above formula, I took all the datas of previous day. Suppose I take today's data and then change the formula as;- ref(fml1,-1) & ref(fml2,-1) Is there any difference between two? Que-2: Is this formula alright to get tomorrow's signal? If not, please suggest the proper way to do the things. Que-3:Please suggest the proper way to get signals through "EXPERT ADVISOR"; to get the list of stocks of prospect buy for the next day through "EXPLORER" and to test this on "ENHANCED SYSTEM TESTER". BASUDEO |
|
#6
|
|||
|
|||
|
Hello OXUS,
I find your expert advice in most of the threads. I shall be very grateful if you please reply my query. I want to change my previous post as follows. Please plot this and give your expert opinion accordingly. po:=Ref(O,-1); pl:=Ref(L,-1); ph:=Ref(H,-1); pc:=Ref(C,-1); fml1:= If(po>=pc,po-(ph-pc),po+(pc-pl)); fml2:= If(po>pc,pl, If(po<pc,ph,po)); Mov(fml1,3,S); Mov(fml2,8,S); ================================ suppose signals are: fml1<fml2 {buy} fml1>fml2 {sell} =============================== Que-1: In the above formula, I took all the datas of previous day. Suppose I take today's data and then change the formula as;- ref(fml1,-1) & ref(fml2,-1) Is there any difference between two? Que-2: Is this formula alright to get tomorrow's signal? If not, please suggest the proper way to do the things. Que-3:Please suggest the proper way to get signals through "EXPERT ADVISOR"; to get the list of stocks of prospect buy for the next day through "EXPLORER" and to test this on "ENHANCED SYSTEM TESTER". BASUDEO |
|
#7
|
||||
|
||||
|
Quote:
Quote:
Quote:
Quote:
Sincerely yours. Last edited by oxusmorouz; 14th July 2007 at 09:46 PM. |
|
#8
|
|||
|
|||
|
Hello OXUS,
Thank you so much for your such a prompt reply. I have slightly updated the formula. The revised formula is: {NEUTRAL} fml1:=If(O>(C*102/100),L, If(O<(C*98/100),H,(O+C)/2)); Mov(Ref(fml1,-1),3,S); {Volatile} a:=C+L-O; b:=C+H-O; d:=2*O-H; f:=2*O-L; fml1:=If(O>=C,(a*d/f)*O/C,(b*f/d)*O/C); Mov(Ref(fml1,-1),3,S); {buy signal}cross(neutral,volatile) {sell signal}cross(volatile,neutral) {above formula only shows the trend and I dont know how to optimize it to pick most profitable troughs and peaks} ============================= dear oxus, I have data upto 13/07/2007. I could not visualize as the bar of 13/07/2007 refers to the data of previous bar so what signal it gives. I mean the signal for 13/07/2007 or 14/07/2007. Where is the signal for actusal 13/07/2007 as the chart is not extending to next bar. If the bar of 13/07/2007 gives the signal for next bar by taking the data of the previous bar, why it is necesaary to take the data of the previous bar? This may seem very innocent but it is boggling me. You please give a simple example of writing "expert advisor". When I tried to plot the signals I am getting the signal for the same bar and not the next bar. Thanks a lot, Basudeo |
|
#9
|
|||
|
|||
|
Quote:
Regarding the expert advisor, here's an example of a moving average crossover (just an example...) Tools ---> Expert adviser ---> new ---> Give it a name ---> Symbols ---> new 1) Name = Long Enter. Formula: a:= Mov(C,5,S); {Fast MA} b:= Mov(C,8,S); {Slow MA} Cross(a,b); {Condition} 2) Short Enter: Formula: a:= Mov(C,5,S); {Fast MA} b:= Mov(C,8,S); {Slow MA} Cross(b,a); {Condition} x----------------------------------------x Go to highlights ---> New 1) Name = Long Phase Colour = Green Formula: a:= Mov(C,5,S); {Fast MA} b:= Mov(C,8,S); {Slow MA} BarsSince(a) < BarsSince(b); {Condition} 2) Name = Short Phase Colour = Red Formula: a:= Mov(C,5,S); {Fast MA} b:= Mov(C,8,S); {Slow MA} BarsSince(a) > BarsSince(b); {Condition} x--------------------------------------------------x Writing commentary is a tricky part and pretty difficult as compared with coding. However, it isn't as important. Sincerely yours. |
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads for: Bar Delay in Trading System
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Delay in Quotetracker RT | aroonsankar | Software | 3 | 29th November 2007 05:35 PM |
| trading system for beginner | oilman5 | Technical Analysis | 33 | 5th May 2007 11:51 AM |
| RMO Trading System | raj69 | Technical Analysis | 1 | 27th December 2006 07:46 AM |
| sequential trading system | gandhiadg | Technical Analysis | 4 | 13th August 2005 11:21 PM |
| Delay in displaying post | neeraj4u | Your Feedback & Suggestions | 1 | 26th July 2005 09:50 AM |
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.