set fibonacci for stoploss and takeprofit

 
Hi,

I tried to set fibonacci for stoploss and takeprofit, and use the following:

       double highest = High[iHighest(Symbol(),PERIOD_H1,MODE_HIGH,p,0)];
       double lowest  = Low[iLowest(Symbol(),PERIOD_H1,MODE_LOW,p,0)];
       double tpb = (OrderOpenPrice()-lowest)*1.618;
       double tps = (highest-OrderOpenPrice())*1.618;
       double slb = (OrderOpenPrice()-lowest)*0.386;
       double sls = (highest-OrderOpenPrice())*0.386;
either I put them inside OrderSend function, nor set them as conditions to close trade, both ended up big failure. My EA doesn't recognize both at all. I have check BAT EA since it also use fibonacci for stoploss and takeprofit, I got headache instead.

Will someone please help....

Thank you.
 
I think you want this:

       double highest = High[iHighest(Symbol(),PERIOD_H1,MODE_HIGH,p,0)];
       double lowest  = Low[iLowest(Symbol(),PERIOD_H1,MODE_LOW,p,0)];
       double tpb = OrderOpenPrice()+(OrderOpenPrice()-lowest)*1.618;
       double tps = OrderOpenPrice()-(highest-OrderOpenPrice())*1.618;
       double slb = OrderOpenPrice()-(OrderOpenPrice()-lowest)*0.386;
       double sls = OrderOpenPrice()+(highest-OrderOpenPrice())*0.386;
 
You're right, Rosh. It does work! Thank you very much.
Reason: