Rank: Newbie
  Groups: Registered, Registered Users Joined: 7/21/2005(UTC) Posts: 2
  
 
     | 
    
        
            
	      
                Dear experts, 
I have created a simple trading system to alert me to buy/sell s follow: 
Buy signal 
PRICE >Mov(C,10,E) AND Cross(MACD(),Mov(MACD(),9,E)) 
Sell signal 
PRICE < Mov(C,10,E) AND Cross(Mov(MACD(),9,E),MACD()) 
the formula work, but i noticed it only generate the buy/sell signal when Price > EMA10 & MACD cross over from the bottom or Price < EMA10 & MACD crossover from the top (at the same time) 
It can not generate the buyl signal when Price > EMA10 but later MACD cross over from the bottom or Price > EMA10 later when MACD has cross over from the bottom  
or 
the sell signal when Price < EMA10 but later MACD cross over from the top or Price < EMA10 later when MACD has cross over from the top 
I need a simple formula  
to generate a buy signal, as long as  
1.when Price > EMA10 together with MACD crossover from the bottom (at the same time) 
or 
2.when MACD cross over from the bottom with the condition that Price is already above EMA10 
or  
3. when Price > EMA10 with the condition that MACD has crossover from the bottom  
  
  
to generate a sell signal, as long as  
1.when Price < EMA10 together with MACD crossover from the top (at the same time) 
or 
2.when MACD cross over from the top with the condition that Price is already below EMA10 
or  
3. when Price < EMA10 with the condition that MACD has crossover from the top 
  
I greatly appreciate all your help! 
Thank you!  
  
  
   
            
  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
     | 
        
        
        
            
        
            
            
    
        
Rank: Advanced Member
  Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,112 Location: Perth, Western Australia
  Was thanked: 17 time(s) in 17 post(s)
  
 
     | 
    
        
            
	      
                Hi asiatrader,
  Welcome to the forum.
  I don't have a lot of time to fully dissect what you are trying to do; my first impression is that you want to replace your code with this:
  ------------------
  buy:= PRICE > Mov(C,10,E) AND MACD() > Mov(MACD(),9,E); buy:=buy and Alert(buy=0,2);
  sell:= PRICE < Mov(C,10,E) AND MACD() < Mov(MACD(),9,E); sell:=sell and Alert(sell=0,2);
  {plot} buy-sell;
  -----------------
  ??????????
  or something along those lines?
 
 
  Hope this helps.
  wabbit [:D]
 
  
            
  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
     | 
        
        
        
    
        
            
            
    
        
Rank: Newbie
  Groups: Registered, Registered Users Joined: 7/21/2005(UTC) Posts: 2
  
 
     | 
    
        
            
	      
                Hi, wabbit 
thank for your reply. 
I would like to create the system under expert advisor to come out buy/sell signal 
when P > EMA10 with/and MACD Buy Signal/MACD Buy signal with/and P > EMA10 
when P < EMA10 with/and MACD Sell Signal/MACD Sell signal with/and P < EMA10 
However, the following code 
Buy:= PRICE > Mov(C,10,E) AND MACD() > Mov(MACD(),9,E); sell:= PRICE < Mov(C,10,E) AND MACD() < Mov(MACD(),9,E);
  only perform the logic of AND but not WITH (time lag problem) 
AND -> both EMA10 & MACD have to fulifill the conditions above at the same time 
eg P > EMA10 & MACD Buy signal at 9:00am  
WITH -> either EMA10 or MACD can be fulfilled later as long as one of the condition meet 
eg P > EMA10 at 9:00am but MACD Buy signal at 10:00am 
or MACD Buy Signal at 9:00am but P > EMA10 at 10:00am 
  
the above code can not come out the buy/sell signal for the condition of WITH  
Anyone can help me about this? 
Thank You 
  
Best Regards 
  
  
  
  
  
  
   
            
  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
     | 
        
        
        
    
                           
    
| Users browsing this topic | 
| 
 
Guest (Hidden) 
 | 
    
        Forum Jump
         
    
    You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.