Need help with lowest point !!

Back to topics list To post a new topic, please log in or register
avatar
3
blankersharm 2015.03.24 18:18
 

 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 ; 
  
avatar
Moderator
3418
GumRai 2015.03.24 23:34 #
 
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

 

avatar
12998
WHRoeder 2015.03.25 01:59 #
 
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.
avatar
3
blankersharm 2015.03.25 12:38 #
 
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
avatar
3
blankersharm 2015.03.25 12:52 #
 
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 

Back to topics list  

To add comments, please log in or register