Need help with lowest point !!

 

 Hey guys,

 

I am new to this forum and i really hope you can help me out.

The problem is that i want to take profit at the lowest point from 30 bars back

and i want my stop loss at OPEN[0]  - LOWEST POINT + OPEN[0] but i doesnt work the way i did it :p

 

Look below and i really hope you can help me  

 

 

double Var1 = Open[0];


double Sell1_1 =  Var1  - Low[iLowest(NULL,0,MODE_OPEN,40,0)]  +  Var1 ;
double Sell1_2 = Open[0];

   

  
   //--  Close Short Conditions
   TrueCloseShort = Low[iLowest(NULL,0,MODE_OPEN,40,0)] > Open[0] || Sell1_1 < Sell1_2 ; 
  
 
double Var1 = Open[0];


double Sell1_1 =  Var1  - Low[iLowest(NULL,0,MODE_OPEN,40,0)]  +  Var1 ;
double Sell1_2 = Open[0];

   

  
   //--  Close Short Conditions
   TrueCloseShort = Low[iLowest(NULL,0,MODE_OPEN,40,0)] > Open[0] || Sell1_1 < Sell1_2 ; 

A simple Print of Sell1 will tell you if you are not getting what you expect

Low[iLowest(NULL,0,MODE_OPEN,40,0)] > Open[0]

It is impossible for the lowest open price to be > the current bar's  open price

Sell1_1 < Sell1_2 

 Again, impossible

 
GumRai: It is impossible for the lowest open price to be > the current bar's  open price
Low[iLowest(NULL,0,MODE_OPEN,40,0)] > Open[0]
If the lowest open price can't be > Open[0] then the Low of that bar also can't be.
 
Oke i understand what i did is impossible but i want to make that if the current price is lower then the lowest price 30 bar ago he takes profit
 
So i did this and the take profit now works.

 

double val=Low[iLowest(NULL,0,MODE_OPEN,40,10)];
double val2=Bid - val + Bid;
   //--  Long Conditions
   
   
   //--  Close Short Conditions

   TrueCloseShort = val > Bid || val2 < Bid; 

 

But i need the stoploss set at the distance between actual price - lowest point + actual price 

Reason: