Thread: Ask!
View Single Post
  #1077 (permalink)  
Old 05-02-2008, 07:46 PM
Michel Michel is offline
Senior Member
 
Join Date: Feb 2006
Posts: 525
Michel is on a distinguished road
Quote:
Originally Posted by Dave137 View Post
PHP Code:
void TrailingPositions() {
  
double pBidpAskpp;

  
pp MarketInfo(OrderSymbol(), MODE_POINT);
  if (
OrderType()==OP_BUY) {
   
pBid MarketInfo(OrderSymbol(), MODE_BID);

//BreakEven routine
    
if (BreakEven>0) {
      if ((
pBid-OrderOpenPrice())>BreakEven*pp) {
         if ((
OrderStopLoss()-OrderOpenPrice())<0) {
            
ModifyStopLoss(OrderOpenPrice()+0*pp);
         }   
      }    
    }
    
    if (
TrailingStop>0) { 
    
    if ((
pBid-OrderOpenPrice())>TrailingStop_Over135*pp){ //15 pips TS
    
    
ModifyStopLoss(pBid-TrailingStop_Over135*pp);
    
    if (
pBid-OrderOpenPrice()>TrailingStop_Over90*pp && pBid-OrderOpenPrice()<TrailingStop_Over135*pp){ //55 pips TS
    
    
ModifyStopLoss(pBid-TrailingStop_Over90*pp);

    if ((
OrderOpenPrice()-pAsk)>TrailingStop +TrailingStep+1*pp && (OrderOpenPrice()-pAsk) < TrailingStop_Over90*pp+TrailingStep-1*pp || OrderStopLoss()==0) {//75 pips TS
      
    
ModifyStopLoss(pAsk+TrailingStop*pp);
    
    
 
        return;
      }
     }
    }
   }
  } 
Three levels of Trailing Stop:
1) 75 Pips TS up to first 90 Pips Profit.
2) 55 Pips TS after 90 but only up to 135 pips profit.
3) 15 Pips TS after 135 pips profit.

The problem I am having is the Trailing Stop moves both up and down as the price moves up and down . . It should just be moving up as the price profit increases and stop if the price starts dropping! How do I get it to stop moving down as the price drops - The Trailing Stop is acting like a Yo-Yo as the price moves up and down.

I am not sure how to stop this from happening?? Please, I need your expertise!

Humbly,

Dave
for example:
PHP Code:
ts pBid TrailingStop_Over135*pp;
if (
ts OrderOpenPrice() && ts OrderStopLoss()) ModifyStopLoss(ts); 
Reply With Quote