I asked for the code that finds the highest open price. Does this? Does it in the presence of slippage?
What do you think this means?
I asked you so show the code that tests if Bid is 10 pips above last open.Why are you opening a sell when the market is 10 points above any order (not the highest).
Make up your mind, do you want 10 points or 10 pips.
and also check this condition i have added if am right..............
double highest_open_price=0;
int highest_Ticket=-1;
for(int pos=OrdersTotal()-1; pos>=0; pos--)
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES) // Only my orders w/
&& OrderMagicNumber()==0// my magic number
&& OrderSymbol()==Symbol() // and my pair.
&& OrderOpenPrice()>=highest_open_price)
{
highest_open_price=OrderOpenPrice();
highest_Ticket=OrderTicket();
}
RefreshRates();
if (Bid>=highest_open_price+10*Point)
highest_Ticket=OrderSend(Symbol(),OP_SELL,mylot(),Bid,0,0,0,"My Comment",0,0,Red);
}
Please don't post code with a stray }
it is confusing
Try your EA in the strategy tester and you will see if you are right or not
now see how i calculated my pips since high is gotten am i right..........
double highest_open_price=0;
int highest_Ticket=-1;
for(int pos=OrdersTotal()-1; pos>=0; pos--)
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES) // Only my orders w/
&& OrderMagicNumber()==0// my magic number
&& OrderSymbol()==Symbol() // and my pair.
&& OrderOpenPrice()>=highest_open_price)
{
highest_open_price=OrderOpenPrice();
highest_Ticket=OrderTicket();
}
int look_pips=0;
for(pos=OrdersTotal()-1; pos>=0; pos--)
highest_open_price=MathAbs(High[pos]-Low[pos])/Point; //pips levels of the barif (Bid>=highest_open_price && look_pips >=my_pips)
Print("The last price movement more than ",my_pips);
RefreshRates();
highest_Ticket=OrderSend(Symbol(),OP_SELL,mylot(),Bid,0,0,0,"My Comment",0,0,Red);
remember my_pips is added in extern double my_pips =10; and also have not calculated to fit 5digit brokers i will add that latter.
You get the value for highest_open_price in the first loop
Then you loop through the orders again and give it a different value
why?????
am sorry that a mistake i was about to rewrite it before i saw your post. just worked on it more to change it to tick value......
now i use tick value to calculate pips.....
double highest_open_price=0;
int highest_Ticket=-1;
for(int pos=OrdersTotal()-1; pos>=0; pos--)
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES) // Only my orders w/
&& OrderMagicNumber()==0// my magic number
&& OrderSymbol()==Symbol() // and my pair.
&& OrderOpenPrice()>=highest_open_price)
{
highest_open_price=OrderOpenPrice();
highest_Ticket=OrderTicket();
}
double tickvalue = (MarketInfo(Symbol(),MODE_TICKVALUE));
if(Digits == 5 || Digits == 3){
tickvalue = tickvalue*10;
}
if (Bid>=highest_open_price + tickvalue*10)
Print("The last price movement more than ",tickvalue);
RefreshRates();
highest_Ticket=OrderSend(Symbol(),OP_SELL,mylot(),Bid,0,0,0,"My Comment",0,0,Red);
now to add my comment on this tick value. one thing i know is -----10pips is a movement of price upward or down to definite number point stored while 10tick
is count of moving price without storing number
else 10tick can complete in 1 candle far below pips. while 10pips can complete in more than 20bars/candle or even 1bar/candle.
conclusion i dont think i got it right?
please point me through
in addition double MYPIP= MarketInfo(Symbol(), MODE_DIGITS); can it work on this case to get pip
now i joined the code together highest is gotten pips is gotten...
then i back tested it but the result didn't match the code why? am i missing something is there any condition
i still need to add to the code or is it because market i closed...thanks
or should double PipDecimal = (MarketInfo(Symbol(),MODE_DIGITS)); be considered .
double highest_open_price=0;
int highest_Ticket=-1;
for(int pos=OrdersTotal()-1; pos>=0; pos--)
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES) // Only my orders w/
&& OrderMagicNumber()==0// my magic number
&& OrderSymbol()==Symbol() // and my pair.
&& OrderOpenPrice()>=highest_open_price)
{
highest_open_price=OrderOpenPrice();
highest_Ticket=OrderTicket();
}
double PipDecimal=Point;
if(Digits == 5 || Digits == 3)
PipDecimal = PipDecimal*10;
if (Bid>=highest_open_price + PipDecimal *10)
Print("The last price movement more than ",PipDecimal);
RefreshRates();
highest_Ticket=OrderSend(Symbol(),OP_SELL,mylot(),Bid,0,0,0,"My Comment",0,0,Red);
if (Bid>=highest_open_price + PipDecimal *10)
{
Print("The last price movement more than ",PipDecimal);
RefreshRates();
highest_Ticket=OrderSend(Symbol(),OP_SELL,mylot(),Bid,0,0,0,"My Comment",0,0,Red);
}
Without the curly braces, a new trade will be opened every tick
yea i want 10 pips.
and also check this condition i have added if am right..............
Please don't post code with a stray }
it is confusing
Try your EA in the strategy tester and you will see if you are right or not
} -- WHRoeder pointed it out and i have corrected it thanks for noting.
i think WHRoeder: is right in his point about point and pips,now high is gotten i think pips should be considered
now see how i calculated my pips since high is gotten am i right..........
remember my_pips is added in extern double my_pips =10; and also have not calculated to fit 5digit brokers i will add that latter.I have no idea what you are trying to do
You get the value for highest_open_price in the first loop
Then you loop through the orders again and give it a different value
why?????
I have no idea what you are trying to do
You get the value for highest_open_price in the first loop
Then you loop through the orders again and give it a different value
why?????
am sorry that a mistake i was about to rewrite it before i saw your post. just worked on it more to change it to tick value......
now i use tick value to calculate pips.....
thanks for your corrections i appreciate.
now i joined the code together highest is gotten pips is gotten...
then i back tested it but the result didn't match the code why? am i missing something is there any condition
i still need to add to the code or is it because market i closed...thanks
or should double PipDecimal = (MarketInfo(Symbol(),MODE_DIGITS)); be considered .
Without the curly braces, a new trade will be opened every tick
that's great! it worked well... perfectly spotted.
but the only problem is during second order it continue opening multiple order again after first successful order opened well..
please is there anything i did wrong.