View Single Post
  #20 (permalink)  
Old 02-02-2008, 06:21 PM
matrixebiz's Avatar
matrixebiz matrixebiz is offline
Senior Member
 
Join Date: Oct 2006
Posts: 1,218
matrixebiz is on a distinguished road
Just wanted to get the end values of the iCustom line clarified in my head.
Line and Shift

So if I have an Indicator like VQ that only has one graphical line and I what to find out, on the previous closed candle, if it signaled up Arrow for a Buy condition or if it signaled a Sell condition by going down Arrow I would need to set up two condition like;
Code:
double VQ0 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 1,1);
double VQ1 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 2,1);
So the above is going to check for an up condition (up) or sell (down) condition on the closed bar, correct?

Then my Buy and Sell code should be; correct?
Code:
//Buy
   if (VQ0>VQ1 && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount))))

//Sell
   if (VQ0<VQ1 && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount))))
Now if I wanted to add a second indicator so that TWO conditions need to be met at the same time to trigger a trade, it has two graphical lines (Don't know if it matters by how many lines it has, the indicator knows what it's Buy and Sell conditions are, correct?) My code would change to;
Code:
double VQ0 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 1,1);
double VQ1 = iCustom(NULL, 0, "VQ", false,0,5,3,1,5,true,false,true,true,false,true,1485, 2,1);
double QQEA0 = iCustom(NULL, 0, "QQEA",5,14,4.236, 1, 1);
double QQEA1 = iCustom(NULL, 0, "QQEA",5,14,4.236, 2, 1);
and Buy and Sell code should be
Code:
//Buy
   if (VQ0>VQ1 && QQEA0>QQEA1 && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount))))

//Sell
   if (VQ0<VQ1 && QQEA0<QQEA1 && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount))))
Edit: Just did a back test and it seems to be trading like every M30 (Chart TF). I only want it to initiate the trade ONLY at first Signal condition then wait until the next opposite signal condition. Seems like when both indicators agree on a Buy then it trades then when that trade is closed it continues another Buy trade on next candle if conditions are still met. That is not what I want I Only want one trade per Buy/Sell Signal. Thanks


Attached are two EA's one called My First EA that someone modified for me because they thought the conditions were wrong and one I did using a template call YourExpertAdvisor. Are they both correct?
Thank you
Attached Images
File Type: jpg VQ_QQEA.JPG (88.2 KB, 450 views)
Attached Files
File Type: mq4 My First EA 1indi.mq4 (9.1 KB, 67 views)
File Type: mq4 YourExpertAdvisor.mq4 (9.4 KB, 58 views)

Last edited by matrixebiz; 02-02-2008 at 07:18 PM.
Reply With Quote