View Single Post
  #10 (permalink)  
Old 03-26-2007, 05:27 AM
daraknor's Avatar
daraknor daraknor is offline
Senior Member
 
Join Date: Oct 2006
Location: Portland, OR USA
Posts: 996
daraknor is on a distinguished road
This is kind of messy still and not ideal, but it only recalculates the arrays when the bar increments. That is both for performance, and for the fact that the signals change a hundred times while the bar is being drawn.

EntrySignal1 =RSI and TSL crossing means Exit is not used, but declared.
The only time to fire off a second trade is while you are entering the first one. THat can be changed, but I would need to know when else I should allow firing a second trade. It can also be pasted anywhere, but it should probably only be checked once per bar. Maybe inside the EntrySetup() when a new bar is discovered?
I am not handling "probable" exit points at all.

It is kind of quick and dirty, I didn't get the changes made by PContour yet. A lot of junk can be removed safely, I emptied most of the unnecessary bits but a lot of stuff is floating around still. I need to go, my gf is annoyed I've been here all day writing code...
Code:
double RSIBuf[],UpZone[],MdZone[],DnZone[],MaBuf[],MbBuf[];
I'm assuming RSIBuf=RSI Line
UpZone= Volatility Band Top
DnZone = Volatility Band Bottom
MdZone= MBL
MaBuf= unused, possibly RSI Price Line. Since you said RSI, I didn't use this value. Please Note Signal 5 might be A) inaccurate or B) duplicate.
MbBuf = TSL
bool ExitSignal1()
{  //RSI and TSL crossing means Exit
   bool SellNow;
   if( (RSIBuf[1]<MbBuf[1]) && (RSIBuf[0]>MbBuf[0]) )SellNow=true;
   if( (RSIBuf[1]>MbBuf[1]) && (RSIBuf[0]<MbBuf[0]) )SellNow=true;
}

int EntrySignal1()
{ //RSI > TSL means Buy RSI < TSL means Sell
   int value=0;
   if(RSIBuf[0]>MbBuf[0]) value=Buy;
   if(RSIBuf[0]<MbBuf[0]) value=Sell;
   return (value);
}

int EntrySignal2()
{//RSI > MBL means Buy   RSI < MBL means Sell
 //TODO Market reversals when MBL hits 32 or 68 = entry signal? reversal for Phoenix?
   int value=0;
   if(RSIBuf[0]>MdZone[0]) value=Buy;
   if(RSIBuf[0]<MdZone[0]) value=Sell;
   return (value);
}

int EntrySignal3()
{ //RSI > VB means add a second Buy  RSI < VB means add a second Sell
   int value=0;
   if(RSIBuf[0]>UpZone[0]) value=Buy;
   if(RSIBuf[0]<DnZone[0]) value=Sell;
   return (value);   
}
int EntrySignal4()
{ //part of EASY
    int value=0;
    double HighPAC1 = iMA(NULL,0,P_PACPer,P_PACShift,MODE_SMMA,PRICE_HIGH,0);
    double LowPAC1  = iMA(NULL,0,P_PACPer,P_PACShift,MODE_SMMA,PRICE_LOW,0);
    double haClose1 = (Open[0] + High[0] + Low[0] + Close[0])*(0.25);
    if(haClose1 > HighPAC1) value=Buy;
    if(haClose1 < LowPAC1) value=Sell;
    Debug("Signal4 PAC High:"+HighPAC1+" LowPAC1:"+LowPAC1+" haClose1:"+haClose1);
    return(value);
}

int EntrySignal5()
{ //part of EASY
    int value=0;
    double RSILine = iRSI(NULL,0,P_RSIArrPer,PRICE_CLOSE,0); //Period=13 Price=0
    if(RSILine > P_RSI_High)  value=Buy;
    if(RSILine < P_RSI_Low ) value=Sell;
}
Attached Files
File Type: mq4 P6 Chimera.mq4 (28.5 KB, 336 views)
Reply With Quote