Please need help

 

hi guys, i have the following problem, Im using a High and Low Period check for opening trades in my expert. For example, (Highest+Lowest)/2 is MIddle point

it must buy below the middle point and sell above the middle point

double HM1ask   =MarketInfo(M1,MODE_ASK); //M1 is the pair, it's multipair
double HM1bid = MarketInfo(M1,MODE_ASK);
double HM1HIGH = High[iHighest(M1,PERIOD_M1,MODE_HIGH,SafePeriod,0)];//SafePeriod is extern variable 
double HM1LOW = Low[iLowest(M1,PERIOD_M1,MODE_LOW,SafePeriod,0)];//SafePeriod is extern variable 
double HM1MIDLE = (HM1HIGH+HM1LOW)/2;
double HM1MIDLEHIGH = (HM1HIGH+HM1MIDLE)/2;
double HM1MIDLELOW = (HM1LOW+HM1MIDLE)/2;
   
if (HM1ask<HM1MIDLELOW)//BuySignal
{
BM1();//buy a pos
}
else if (HM1bid>HM1MIDLELOW)//SellSignal
{
SM1();//sell a pos
}

This is the source about checking the levels, and this::

void M1()
{
if (M1 == "EURUSD"){M1 = "GBPUSD";AM1();}
else if (M1 == "GBPUSD"){M1 = "NZDUSD";AM1();}
else if (M1 == "NZDUSD"){M1 = "USDCAD";AM1();}
else if (M1 == "USDCAD"){M1 = "USDJPY";AM1();}
else if (M1 == "USDJPY"){M1 = "USDCHF";AM1();}
else if (M1 == "USDCHF"){M1 = "AUDUSD";AM1();}
else if (M1 == "AUDUSD"){M1 = "EURGBP";AM1();}
else if (M1 == "EURGBP"){M1 = "EURCHF";AM1();}
else if (M1 == "EURCHF"){M1 = "EURJPY";AM1();}
else if (M1 == "EURJPY"){M1 = "GBPJPY";AM1();}
else if (M1 == "GBPJPY"){M1 = "EURAUD";AM1();}
else if (M1 == "EURAUD"){M1 = "EURCAD";AM1();}
else if (M1 == "EURCAD"){M1 = "AUDJPY";AM1();}
else if (M1 == "AUDJPY"){M1 = "CADJPY";AM1();}
else if (M1 == "CADJPY"){M1 = "CHFJPY";AM1();}
else if (M1 == "CHFJPY"&&Commodities == false){M1 = "";}
else if (M1 == "CHFJPY"&&Commodities == true){M1 = "XAUUSD";AM1();}
else if (M1 == "XAUUSD"){M1 = "XAGUSD";AM1();}
else if (M1 == "XAGUSD"){M1 = "UKOil";AM1();}
else if (M1 == "UKOil"){M1 = "";}
}

Is the code for swith pairs,

But still it is not working correct becous it buys when it's above the Midleline and Sell below the middelline, maby you guys know something more about it?

greetz willem

 
Ketskroket:

hi guys, i have the following problem, Im using a High and Low Period check for opening trades in my expert. For example, (Highest+Lowest)/2 is MIddle point

it must buy below the middle point and sell above the middle point

This is the source about checking the levels, and this::

Is the code for swith pairs,

But still it is not working correct becous it buys when it's above the Midleline and Sell below the middelline, maby you guys know something more about it?

greetz willem

This is probably your issue . . .

double HM1HIGH = High[iHighest(M1,PERIOD_M1,MODE_HIGH,SafePeriod,0)];   //SafePeriod is extern variable 
double HM1LOW = Low[iLowest(M1,PERIOD_M1,MODE_LOW,SafePeriod,0)];       //SafePeriod is extern variable 

iHighest and iLowest get the bar values for symbol M1 . . . High[] and Low[] get the High and Low for the bar number from the chart symbol, not from symbol M1, use iHigh() and iLow()

 

or use

double HM1HIGH = High[iHighest(M1,0,MODE_HIGH,SafePeriod,0)];   //SafePeriod is extern variable 
double HM1LOW = Low[iLowest(M1,0,MODE_LOW,SafePeriod,0)];       //SafePeriod is extern variable 
 
deVries:

or use


heey i'm sorry but i forgot to say, It's based on multi Pair and multi timeframe, Now i have a problem, i tryd to check the variables of the Midle and all with print, but it says, Marketinfo symbol must be a string????
 
RaptorUK:

This is probably your issue . . .

iHighest and iLowest get the bar values for symbol M1 . . . High[] and Low[] get the High and Low for the bar number from the chart symbol, not from symbol M1, use iHigh() and iLow()


But how can get to the shift then?? i mean, must i do ihighest for the Bar shift and use that in ihigh?

 
Ketskroket:


But how can get to the shift then?? i mean, must i do ihighest for the Bar shift and use that in ihigh?

Yes, correct. Instead of High[] you will use iHigh(M1, PERIOD_M1, iHighest(. . . . ))
 
2013.10.15 16:38:51 Wtrader1 USDJPY,M1: symbol name for MarketInfo function must be a string

 
Ketskroket:
2013.10.15 16:38:51 Wtrader1 USDJPY,M1: symbol name for MarketInfo function must be a string

What did you change ?
 

the High and low what you recommended, but it gives stil an error, This:

The Print function gives me error: symbol name for MarketInfo function must be a string

double HM5ask   =MarketInfo(M5,MODE_ASK); 
    double HM5bid = MarketInfo(M5,MODE_BID);
    double HM5HIGH = iHigh(M5,PERIOD_M5,iHighest(M5,PERIOD_M5,MODE_HIGH,SafePeriod,0));
    double HM5LOW = iLow(M5,PERIOD_M5,iLowest(M5,PERIOD_M5,MODE_LOW,SafePeriod,0));
    double HM5MIDLE = (HM5HIGH+HM5LOW)/2;
    double HM5MIDLEHIGH = (HM5HIGH+HM5MIDLE)/2;
    double HM5MIDLELOW = (HM5LOW+HM5MIDLE)/2;
    Print("Pair = "+M5+" High = "+HM5HIGH+" Low = "+HM5LOW+" MIDLE = "+HM5MIDLE+" 75% = "+HM5MIDLEHIGH+" 25% = "+HM5MIDLELOW+" Ask = "+ HM5ask);
 
Ketskroket:

the High and low what you recommended, but it gives stil an error, This:

The Print function gives me error: symbol name for MarketInfo function must be a string


I'm not sure, but i have string M5, and it's changing every time the symbol? is this correct?
 

Huh, after a wile it starts getting the pairs?

Reason: