//+------------------------------------------------------------------+ //| N&P with Tim.mq4 | //| Nick Lougovskoi | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Nick Lougovskoi" #property link "http://www.metaquotes.net" //---Declaration--Flag Setting--- for Activation/Deactivation of pairs ----- //-------------------filter levels must be set for all pairs for code to be functional!---------(can go wide if no filter level is needed) // These parameters need to be external so that you can adjust them in the properties box // Nick. Don't initialise the filters with Ask. It will reinitialise the filter with the current value every time you start the EA. // Your specification (psuedo code) states that you will set these values manualy on a daily basis (or whenever). // TODO - fix up the rest of the parameter code in this section //+--------------------------------------------------------+ //| EXTERNAL PARAMETERS | //| can be set or adjusted by user in properties window | //+--------------------------------------------------------+ //EURUSD parameters extern bool EUR_USD_BuyFlag = true; //Set to true to allow long trading for this currency pair extern bool EUR_USD_SellFlag = true; //Set to true to allow short trading for this currency pair extern double EUR_USD_TopFilter_Ok; //Set the value of TopFilterLevel manually on a daily basis for EURUSD extern double EUR_USD_BotFilter_Ok; //Set the value of BottomFilterLevel manually on a daily basis EURUSD extern bool GBP_USD_BuyFlag = true; //true = active, false= deactivated for trading extern bool GBP_USD_SellFlag = true; //true = active, false= deactivated for trading extern double GBP_USD_TopFilter_Ok; //Set the value of TopFilterLevel manually on a daily basis for GBPUSD extern double GBP_USD_BotFilter_Ok; //Set the value of BottomFilterLevel manually on a daily basis GBPUSD extern bool USD_JPY_BuyFlag = true; //true = active, false= deactivated for trading extern bool USD_JPY_SellFlag = true; //true = active, false= deactivated for trading extern double USD_JPY_TopFilter_Ok; //Set the value of TopFilterLevel manually on a daily basis for USDJPY extern double USD_JPY_BotFilter_Ok; //Set the value of BottomFilterLevel manually on a daily basis USDJPY extern bool USD_CHF_BuyFlag = true; //true = active, false= deactivated for trading extern bool USD_CHF_SellFlag = true; //true = active, false= deactivated for trading extern double USD_CHF_TopFilter_Ok; //Set the value of TopFilterLevel manually on a daily basis for USDCHF extern double USD_CHF_BotFilter_Ok; //Set the value of BottomFilterLevel manually on a daily basis USDCHF extern bool AUD_USD_BuyFlag = true; //true = active, false= deactivated for trading extern bool AUD_USD_SellFlag = true; //true = active, false= deactivated for trading extern double AUD_USD_TopFilter_Ok; //Set the value of TopFilterLevel manually on a daily basis for AUDUSD extern double AUD_USD_BotFilter_Ok; // extern double LotSize = 1.0 ; // The default value is set to 1.0. The user can change it to whatever is required in the properties window. extern bool DEBUG_ON = true; // This turns on the debug comments for testing and problem solving string Pair[] = {"EURUSD","GBPUSD","USDJPY","USDCHF","AUDUSD"}; //***Global Declaration of Array 'Pair' so we can call it in 'start' function //+------------------------------------------------------------------+ //| Global Parameters //| These can be read or changed from anywhere in this program but | //| not by the user from the properties box //+------------------------------------------------------------------+ int TakeProfitStopSize = 20; // TakeProfit Stop In pips. This can be made external if the user needs to change it. //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- if (DEBUG_ON) Print("*** Debug *** init()"); //---- return(0); } // End of INIT function //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- if (DEBUG_ON) Print("*** Debug *** deinit()"); //---- return(0); } // End of DEINIT function //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { int count = ArraySize(Pair); //computer doesn't know how many elements array has, this is necessary to set the value for 'for' loop for (int c=0;c