Thread: How to code?
View Single Post
  #1016 (permalink)  
Old 06-10-2008, 07:40 PM
IN10TION's Avatar
IN10TION IN10TION is online now
Senior Member
 
Join Date: Mar 2007
Posts: 657
Blog Entries: 1
IN10TION is on a distinguished road
change these...

so, all the conditions are false and stay false till the if() conditions are true.
Remove the StopLong & StopSell in "double", every other "double" can stay.
This will do it for you!

bool BuyCondition=false;
bool SellCondition=false;
bool StopLong=false;
bool StopSell=false;

if((BuyValueCurrent !=0 && BuyValueCurrent2 !=0 && TrendEnvUp != EMPTY_VALUE) && (BuyValueCurrent1min !=0 && BuyValueCurrent21min !=0 && TrendEnvUp1min != EMPTY_VALUE) && (BuyValueCurrent5min !=0 && BuyValueCurrent25min !=0 && TrendEnvUp5min != EMPTY_VALUE)) {BuyCondition=true;}
if((SellValueCurrent !=0 && SellValueCurrent2 !=0 && TrendEnvDown != EMPTY_VALUE) && (SellValueCurrent1min != 0 && SellValueCurrent21min != 0 && TrendEnvDown1min != EMPTY_VALUE) && (SellValueCurrent5min != 0 && SellValueCurrent25min != 0 && TrendEnvDown5min != EMPTY_VALUE)) {SellCondition=true;}
if((SellValueCurrent !=0 && SellValueCurrent2 !=0) || (TrendEnvDown != EMPTY_VALUE)) {StopLong=true;}
if((BuyValueCurrent !=0 && BuyValueCurrent2 !=0) || (TrendEnvUp != EMPTY_VALUE)) {StopSell=true;}



Quote:
Originally Posted by payback View Post
ok ok ok!
here is more!
PHP Code:
double
         BuyValueCurrent
,
         
SellValuePrevious,
         
SellValueCurrent,
         
         
BuyValuePrevious2,
         
BuyValueCurrent2,
         
SellValuePrevious2,
         
SellValueCurrent2,
         
BuyValueCurrent1min,
         
BuyValueCurrent5min,
         
BuyValueCurrent21min,
         
BuyValueCurrent25min,
         
SellValueCurrent1min,
         
SellValueCurrent5min,
         
SellValueCurrent21min,
         
SellValueCurrent25min,
         
         
TrendEnvUp,
         
TrendEnvDown,
         
TrendEnvUp1min,
         
TrendEnvUp5min,
         
TrendEnvDown1min,
         
TrendEnvDown5min,
         
        
Compra,
         
Vendi,
         
StopLong,
         
StopSell
the icustom funcions and buy sell

PHP Code:

 BuyValuePrevious  
iCustom(NULL,TimeFrame,IndicatorName1,NumBars,0,2);
   
BuyValueCurrent iCustom(NULL,0,IndicatorName1,NumBars,1,0);  
   
   
BuyValuePrevious2  iCustom(NULL,TimeFrame,IndicatorName2,NumBars,0,2);  
   
BuyValueCurrent2 iCustom(NULL,0,IndicatorName2,NumBars,0,0);  
   
   
SellValuePrevious iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);
   
SellValueCurrent  iCustom(NULL,0,IndicatorName1,NumBars,0,0);
   
   
SellValuePrevious2 iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);  
   
SellValueCurrent2 iCustom(NULL,0,IndicatorName2,NumBars,1,0);  
   
   
BuyValueCurrent1min iCustom(NULL,1,IndicatorName1,NumBars,1,0);
   
BuyValueCurrent5min iCustom(NULL,5,IndicatorName1,NumBars,1,0);
   
BuyValueCurrent21min iCustom(NULL,1,IndicatorName2,NumBars,0,0);
   
BuyValueCurrent25min iCustom(NULL,5,IndicatorName2,NumBars,0,0);
   
SellValueCurrent1min  iCustom(NULL,1,IndicatorName1,NumBars,0,0);
   
SellValueCurrent5min  iCustom(NULL,5,IndicatorName1,NumBars,0,0);
   
SellValueCurrent21min iCustom(NULL,1,IndicatorName2,NumBars,1,0);
   
SellValueCurrent25min iCustom(NULL,5,IndicatorName2,NumBars,1,0);
   
   
   
   
TrendEnvUp         iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0); // trendenvelopes 
   
TrendEnvDown         iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0); // trendenvelopes 
   
TrendEnvUp1min         iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);
   
TrendEnvUp5min         iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);
   
TrendEnvDown1min         iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);
   
TrendEnvDown5min         iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);
   
   
   
   
BuyCondition    = (BuyValueCurrent !=&& BuyValueCurrent2 !=&& TrendEnvUp != EMPTY_VALUE)&& (BuyValueCurrent1min !=&& BuyValueCurrent21min !=&& TrendEnvUp1min != EMPTY_VALUE) && (BuyValueCurrent5min !=&& BuyValueCurrent25min !=&& TrendEnvUp5min != EMPTY_VALUE) ;
   
SellCondition     = (SellValueCurrent !=&& SellValueCurrent2 !=&& TrendEnvDown != EMPTY_VALUE)&& (SellValueCurrent1min != && SellValueCurrent21min != && TrendEnvDown1min != EMPTY_VALUE)&& (SellValueCurrent5min != && SellValueCurrent25min != && TrendEnvDown5min != EMPTY_VALUE) ;
   
StopLong  = ((SellValueCurrent !=&& SellValueCurrent2 !=0) || (TrendEnvDown != EMPTY_VALUE));
   
StopSell  = ((BuyValueCurrent !=&& BuyValueCurrent2 !=0) || (TrendEnvUp != EMPTY_VALUE)); 
the exit condition

PHP Code:


StopBuy  
= (SellValueCurrent !=&& SellValueCurrent2 !=|| TrendEnvDown != EMPTY_VALUE);
StopSell  = (BuyValueCurrent !=&& BuyValueCurrent2 !=|| TrendEnvUp != EMPTY_VALUE); 

Last edited by IN10TION; 06-10-2008 at 07:46 PM.
Reply With Quote