[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 892

 

Hi ! I can't figure out what's wrong with ???? Does not modify market order
slb =NormalizeDouble(Bid - (StopLoss * Point),Digits); // calculate stop for buy positions//
tpb =NormalizeDouble(Ask + (TakeProfit* Point),Digits); // calculate profit for buy positions//
sls =NormalizeDouble(Ask + (StopLoss * Point),Digits) // calculation of stop for sell positions//
tps =NormalizeDouble(Bid - (TakeProfit* Point),Digits);

//================================================== ==================//
int total=OrdersTotal();
int n=0;
for (int i=total-1; i>=0; i--)
{
if(OrderSelect(i, SELECT_BY_POS))
{
if(OrderSymbol()==Symbol())
{
n++;
}}}
if ( total == 1 )
{
for (int k=total-1; k>=0; k--)
{
if(OrderSelect(k, SELECT_BY_TICKET)
Alert("order is", k);
{
if ((OrderType()==OP_BUY)&&(OrderTakeProfit()==0)&&(O rderStopLoss()==0))
{
OrderModify(k,OrderOpenPrice(),slb,tpb,0,Blue);
Alert("error", GetLastError());

}}}}
return(0);}

WHAT'S THE PROBLEM PLEASE HELP ...........?????

 

Any newcomer's question, so as not to clutter up the forum. Don't let the pros pass you by. It's nowhere without you.

 
belck:

Any newcomer's question, so as not to clutter up the forum. Don't let the pros pass you by. It's nowhere without you.

What's your point? It's like you can ask about time... or health... :))))))
 


Sorry, I do not understand what is the problem. I think I never fulfill the while condition, because if I put Comment inside the loop, it is not reflected. Also above the loop I have the variable B equal to the normal expected value, such as 0.0011, but if I multiply it by Point, it comes out 0!!!!

int start()

{
double A,B,C ;A=Close[1];B=Close[Bars];
C=A-B ;Comment("Value of differencei ", B*Point);
while (B*Point >Swing)
{ Comment("Value of Difference ", B);
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-stoploss*Point,Ask+TakeProfit*Point,"macd sample",16384,0,Green);}

while (0-B*Point<Point)
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+stoploss*Point,Bid-TakeProfit*Point,"macd sample",16384,0,Red);

Alert("Value ", B);

Comment("Value differencei ",B);

//----

//----
return(0);
}

 

I'm not sure but the correct way would be

int start()

{
double A,B,C ;A=Close[1];B=Close[bars]; What does Close[bars] mean; ???? Close[bar number sequence backwards, without current]

previous candle close[1]. previous candle close[2]

B=(A-B)*Point ; Comment("Value of difference ", B); B will be equal to the close of the previous candle minus the close of the candle you set in B= close [....]
while (B > B) and most likely not while a if the condition
{ Comment("Value Difference ", B);
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-stoploss*Point,Ask+TakeProfit*Point,, "macd sample",16384,0,Green);

}

while (0-B<Round) and most likely not while a if condition

{

OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+stoploss*Point,Bid-TakeProfit*Point, "macd sample",16384,0,Red);
}
Alert("Value ",B);

Comment("Value differencei ",B);

//----

//----
return(0);
}
Could be wrong.....

 
Thank you!!! I'll give it a try. For three days I can't figure out what's wrong, technically everything seems right.
 
No, it's the same thing. Thanks for the answer. I don't know what the problem is.
 

There are a lot of errors in your code ...... what do you want to do what result??? There should be no Russian letters...

You can't have C in the spreadsheet because C has a number in memory like 1.23456

0-B would be a negative number....

 

and it is better to calculate profit and loss as follows

slb =NormalizeDouble(Bid - (StopLoss * Point),Digits); // calculate stop for buy positions//
tpb =NormalizeDouble(Ask + (TakeProfit* Point),Digits); // calculate profit for buy positions//
sls =NormalizeDouble(Ask + (StopLoss * Point),Digits) // calculate stop for sell positions//
tps =NormalizeDouble(Bid - (TakeProfit* Point),Digits); // calculate profit for sell positions//

 
Dimka-novitsek:


Sorry, I do not understand what is the problem. I think I never fulfill the while condition, because if I put Comment inside the loop, it is not reflected. Also above the loop I have the variable B equal to the normal expected value, such as 0.0011, but if I multiply it by Point, it comes out 0!!!!

int start()

{
double A,B,C ;A=Close[1];B=Close[Bars];
C=A-B ;Comment("Value of differencei ", B*Point);
while (B*Point >Spread)
{ Comment("Value of Difference ", B);
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-stoploss*Point,Ask+TakeProfit*Point,"macd sample",16384,0,Green);}

while (0-B*Point<Point)
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+stoploss*Point,Bid-TakeProfit*Point,"macd sample",16384,0,Red);

Alert("Value ", B);

Comment("Value differencei ",B);

//----

//----
return(0);
}

And you're wooing that you need to multiply the difference between A and B by Point?

The values of A and B are real numbers. By multiplying their difference by Point, you further increase the number of decimal places. If you need to get an integer to compare with a "Spread" integer, you should rather divide by Point.

Reason: