Thread: How to code?
View Single Post
  #1528 (permalink)  
Old 01-12-2009, 01:08 PM
Moxy's Avatar
Moxy Moxy is offline
Junior Member
 
Join Date: Oct 2007
Posts: 2
Moxy is on a distinguished road
Post Help with Logic

Hi all,

I would like a little help with some code logic. I am trying to build an EA of a system I am looking at but am a little puzzled how to write the logic for Buy and Sell Signals. Here is the Pseudo logic of what I want to turn into MQL:

BUY LOGIC:

Code:
If (MA_1 > MA_2) and (Previous(MA_1 < MA_2))                // A moving average cross mean we have a "GET READY" signal

//	Once we have a "GET READY" signal the following conditions need to be true
//	in order for the system to create a "BUY_SIGNAL".
//      Note: the following conditions do not necessarily have to become true on the exact same bar,
              but need to trigger true within + or - 2 bars of the "GET READY" bar.

	( CLOSE > MA3 )	                                    // Price closes above a MA
        ( CCI Crosses above the ZERO line )                 // CCI crosses up above zero
        ( Fast Stochastic crosses above Slow Stochastic )   // Stochastic triggers to the up side
The Sell Logic is just the opposite of the buy logic.

I don't need full EA code just the logic converted to MQL 'IF' and 'LOOP' statements to workout the signal. I think I can figure out the OpenOrder code etc... from many examples already in this thread.

Any help anyone can give would be much appreciated.

Thanks,
Moxy

Last edited by Moxy; 01-12-2009 at 09:52 PM.
Reply With Quote