Indicator Question Statement
  #1 (permalink)  
Old 06-19-2005, 04:15 AM
Sophomore
 
Join Date: Jun 2005
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Dave77 is a jewel in the roughDave77 is a jewel in the roughDave77 is a jewel in the roughDave77 is a jewel in the rough
Question Indicator Question Statement

If I want an indicator MA crossover where the sell signal is generated 5 pips after the crossover takes place, how do I state this in the logic statement that your program will accept. If MA(1) previous crosses MA(2) current - 5 pips then sell. Can you create 2 statements such as Statement 1) And MA(1) current < MA(2) previous. Statement 2) AND MA(1) current <=MA(2) previous -.0005??

Please help me on this basic question. This program is an answer to my prayers! I hope you can help me on this question.

Sincerely,

Dave Diebold
ddiebold@sbcglobal.net
713-977-1892
Reply With Quote
  #2 (permalink)  
Old 06-19-2005, 06:45 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,908
Thanks: 87
Thanked 346 Times in 143 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

In beta 1, there is no automatic way to do this; however, you'll need to get your hands dirty a bit for the same funcationality.

1. Leave the crossover logics intact without caring about the "5 pips thing". (Just add the crossover logics)

2. Open or Modify the expert in MetaEditor.

3. Find:
Code:
// Check for BUY, SELL, and CLOSE signal IsBuying = .... ; IsSelling = .... ; IsClosing = ... ;
4. Add following lines BEFORE above code block
Code:
// Note the bid price at crossover point defines: FilterPips(0.0005); var: CrossBid(0),IsBuyingBak(False),IsSellingBak(False);
5. Add following lines BELOW
Code:
// Check price filter if (IsBuying and not IsBuyingBak) or (IsSelling and Not IsSellingBak ) then { CrossBid = pricebid ; } IsBuyingBak = IsBuying; IsSellingBak = IsSelling; IsBuying = IsBuying and (PriceBid >= CrossBid + FilterPips); IsSelling = IsSelling and (PriceBid <= CrossBid - FilterPips);
6. Finally you'll have similar to below:
Code:
// Note the bid price at crossover point defines: FilterPips(0.0005); var: CrossBid(0),IsBuyingBak(False),IsSellingBak(False); // Check for BUY, SELL, and CLOSE signal IsBuying = ....... ; IsSelling = ....... ; IsClosing = ...... ; // Check price filter if (IsBuying and not IsBuyingBak) or (IsSelling and Not IsSellingBak ) then { CrossBid = pricebid ; } IsBuyingBak = IsBuying; IsSellingBak = IsSelling; IsBuying = IsBuying and (PriceBid >= CrossBid + FilterPips); IsSelling = IsSelling and (PriceBid <= CrossBid - FilterPips);
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #3 (permalink)  
Old 06-19-2005, 06:48 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,908
Thanks: 87
Thanked 346 Times in 143 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

In case you don't know how to setup crossover properly, you should watch the Video Walkthrough: Create a simple MACD Cross expert.
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #4 (permalink)  
Old 06-20-2005, 10:00 AM
Freshman
 
Join Date: Jun 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
rondio is on a distinguished road
Default

Scorpion,
Can this pip filter hack be modified for time? Example: if cross stays true for "x" amount of time (ticks) then signal is true. Might work better for some purposes.

thanks
Reply With Quote
  #5 (permalink)  
Old 06-20-2005, 11:40 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,908
Thanks: 87
Thanked 346 Times in 143 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

No, it's a total difference, and might require more coding. If only I had had more time on this.
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #6 (permalink)  
Old 06-22-2005, 04:34 AM
Freshman
 
Join Date: Jun 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
rondio is on a distinguished road
Default

Scorp,
is there a simple way to add a time function to a ma a cross? i had tried many variations on the code below, but i can not get it to work. seems like it should not be that hard. any ideas?

// Check for BUY, SELL, and CLOSE signal
IsBuying = (ma2_0 > ma3_0 >= (15)Minute);
IsSelling = (ma2_0 < ma3_0 >= (15)Minute);

the logic i am trying to code is to buy if ma 2 is greater than ma3 for 15 minutes or more.
Reply With Quote
  #7 (permalink)  
Old 06-27-2005, 06:21 AM
Sophomore
 
Join Date: Jun 2005
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Dave77 is a jewel in the roughDave77 is a jewel in the roughDave77 is a jewel in the roughDave77 is a jewel in the rough
Cool

Scorpion I phrased my program wrong. What I need is a crossover condition where a crossover takes place and then the ma averages (gap) grows apart from each other .0005 pips (Variable) (difference between one moving (2 Exp MA average) and the other (30 LWMA) within the last 3 (Variable) candles before a buy or sell signal takes place.

The program is not working right with a cross over + .0005 pips filter. I need the Moving average gap variable filter to signal a buy or sell.

This should solve one of my biggest problems I am having so far. Could I ask that you rephrase that part of my program.


I wish there was a school on coding this stuff. I asked you a question before on the phrasing to check to see if current price is lower (or higher) than the lowest low during 10 previous candles.

Your answer was:

PriceBid<Lowest(Mode_low,10,10) and no doubt Pricebid>Highest(Mode_high,10,10)

Is this to be placed after: IsBuying=(ma2_1) etc. etc. and (ma2_0) etc. etc., Likewise IsSelling= . . . . . in my program??

I have attached the MQL File. Thanks Scorpion. You do not realize how frustrating it is not to be able to figure this programming stuff out on my own. Have you thought about writing a book on MQL for traders, by example?? If I get this program working right in the near future, tell me what you like to drink, and I will send you a bottle of it!!
Attached Files
File Type: mql MASTER FOREX PROGRAM-3B.mql (5.3 KB, 27 views)
Profitable Forex Systems
Automatically trade proven forex trading systems.
Real trading records available!

Last edited by Dave77 : 06-27-2005 at 02:40 PM.
Reply With Quote
  #8 (permalink)  
Old 06-27-2005, 03:48 PM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,908
Thanks: 87
Thanked 346 Times in 143 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

Quote:
Originally Posted by Dave77
Scorpion I phrased my program wrong. What I need is a crossover condition where a crossover takes place and then the ma averages (gap) grows apart from each other .0005 pips (Variable) (difference between one moving (2 Exp MA average) and the other (30 LWMA) within the last 3 (Variable) candles before a buy or sell signal takes place.
That's much simpler then; no need to do pips filter hack. Assume MA (1) is 2-period EMA, and MA (2) is 30-period LWMA. Enter below logics into ZeroCode:

Buy logics:
MA (1) Previous < MA (2) Previous + 0.0005
AND MA (1) Current > MA (2) Current + 0.0005

Sell logics:
MA (1) Previous > MA (2) Previous - 0.0005
AND MA (1) Current < MA (2) Current - 0.0005

Quote:
Originally Posted by Dave77
Your answer was:

PriceBid<Lowest(Mode_low,10,10) and no doubt Pricebid>Highest(Mode_high,10,10)

Is this to be placed after: IsBuying=(ma2_1) etc. etc. and (ma2_0) etc. etc., Likewise IsSelling= . . . . . in my program??
You can add that in ZeroCode as logics. No need to hack in the mql.
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.

Last edited by scorpion : 06-27-2005 at 03:52 PM.
Reply With Quote
  #9 (permalink)  
Old 06-28-2005, 03:51 AM
Sophomore
 
Join Date: Jun 2005
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Dave77 is a jewel in the roughDave77 is a jewel in the roughDave77 is a jewel in the roughDave77 is a jewel in the rough
Smile

Thank you kindly! Now I have got to backtest and trouble shoot the unique conditions that it does not cover. Step one in the right direction has been accomplished thanks to you and your compiler. Thanks Again!
Reply With Quote
  #10 (permalink)  
Old 06-29-2005, 04:38 AM
Freshman
 
Join Date: Jun 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
rondio is on a distinguished road
Default

Quote:
Originally Posted by rondio
Scorp,
is there a simple way to add a time function to a ma a cross? i had tried many variations on the code below, but i can not get it to work. seems like it should not be that hard. any ideas?

// Check for BUY, SELL, and CLOSE signal
IsBuying = (ma2_0 > ma3_0 >= (15)Minute);
IsSelling = (ma2_0 < ma3_0 >= (15)Minute);

the logic i am trying to code is to buy if ma 2 is greater than ma3 for 15 minutes or more.
anybody know any resources on the net i can use to solve this problem? i believe i could have a very powerful system if i could get this to work. i have not been able to find anything simular. if anybody could help i would appreciate it.

thanks
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested If statement - 3 Conditions Dave77 Tutorials, Tips & Tricks 0 08-18-2006 07:55 AM
Help needed for MQLII audible Alarm statement Dave77 MetaTrader and ZeroCode 3 08-31-2005 02:47 AM
RSI - MQL II Indicator Statement Problem Dave77 MetaTrader and ZeroCode 2 07-16-2005 11:33 PM
Indicator Statement Question 2 Dave77 MetaTrader and ZeroCode 1 06-19-2005 05:33 AM


All times are GMT. The time now is 11:55 AM.
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now