[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 757

 
artmedia70:
Do you want the total profit of all open positions, or do you want to put a stop on each one when it reaches 20 pips in profit?
If you think that only one position will be opened at a time, then you should set a stop on its profit
 

Hi. There is an arbitrage strategy, is it perfect? I.e. is it unreal to lose on it or does the price not always reach the right level?

Thank you

 
on each stop when a profit reaches 20 pips
 

I'm doing it wrong again :(

Why isn't it comparing?

if (
   (NormalizeDouble((StrToDouble(ObjectFind("signal01"))),0)>NormalizeDouble((StrToDouble(ObjectFind("signal31"))),0))//&&
   /*(NormalizeDouble((StrToDouble(ObjectFind("signal11"))),2)>NormalizeDouble((StrToDouble(ObjectFind("signal31"))),2))&&
   (NormalizeDouble((StrToDouble(ObjectFind("signal21"))),2)>NormalizeDouble((StrToDouble(ObjectFind("signal31"))),2))&&
   (NormalizeDouble((StrToDouble(ObjectFind("signal41"))),2)>NormalizeDouble((StrToDouble(ObjectFind("signal31"))),2))&&
   (NormalizeDouble((StrToDouble(ObjectFind("signal51"))),2)>NormalizeDouble((StrToDouble(ObjectFind("signal31"))),2))&&
   (NormalizeDouble((StrToDouble(ObjectFind("signal61"))),2)>NormalizeDouble((StrToDouble(ObjectFind("signal31"))),2))&&
   (NormalizeDouble((StrToDouble(ObjectFind("signal71"))),2)>NormalizeDouble((StrToDouble(ObjectFind("signal31"))),2))*/)
   {ObjectSetText("sig_nal201",CharToStr(230),10,"Wingdings",SymbolSellColor);
      Print("Ошибка при вызове sig_nal201 1:",GetLastError());}
   else if (
   (NormalizeDouble((StrToDouble(ObjectFind("signal01"))),0)<NormalizeDouble((StrToDouble(ObjectFind("signal31"))),0))//&&
   /*(NormalizeDouble((StrToDouble(ObjectFind("signal11"))),2)<NormalizeDouble((StrToDouble(ObjectFind("signal31"))),2))&&
   (NormalizeDouble((StrToDouble(ObjectFind("signal21"))),2)<NormalizeDouble((StrToDouble(ObjectFind("signal31"))),2))&&
   (NormalizeDouble((StrToDouble(ObjectFind("signal41"))),2)<NormalizeDouble((StrToDouble(ObjectFind("signal31"))),2))&&
   (NormalizeDouble((StrToDouble(ObjectFind("signal51"))),2)<NormalizeDouble((StrToDouble(ObjectFind("signal31"))),2))&&
   (NormalizeDouble((StrToDouble(ObjectFind("signal61"))),2)<NormalizeDouble((StrToDouble(ObjectFind("signal31"))),2))&&
   (NormalizeDouble((StrToDouble(ObjectFind("signal71"))),2)<NormalizeDouble((StrToDouble(ObjectFind("signal31"))),2))*/)
   {ObjectSetText("sig_nal201",CharToStr(228),10,"Wingdings",SymbolBuyColor);
      Print("Ошибка при вызове sig_nal201 2:",GetLastError());}
   else {ObjectSetText("sig_nal201",CharToStr(224),10,"Wingdings",SymbolBasisColor);
      Print("Ошибка при вызове sig_nal201 3:",GetLastError());}
I've commented out, I compare 2 values - it always draws the last one...
 
profitinvesting:
for each one to put its own stop when it reaches 20 pips profit

Igor Kim has a function that sets a stop at the Breakeven level for a given number of pips (it can also be set):

Function MovingInWL()

 
Abzasc:

I'm doing it wrong again :(

Why doesn't it compare?

I've commented out unnecessary, I compare 2 values - always the last one is drawn...

Interesting... ObjectFind(); returns the number of the chart subwindow where this object is found:

Search for an object with the specified name. The function returns the index of the window to which the object belongs. If it fails, the function will return -1. Call the GetLastError() function to get more information about the error. The chart subwindows (if there are indicator subwindows in the chart) are numbered starting from 1. The main chart subwindow is always present and has the index 0.

And what are you comparing it to?

(NormalizeDouble((StrToDouble(ObjectFind("signal01"))),0)>NormalizeDouble((StrToDouble(ObjectFind("signal31"))),0))

I find this construction a bit strange. Why normalize the subwindow number(int), moreover, converted into double , and by the StrToDouble() function?

 
Abzasc:

Why doesn't it compare?

Maybe because I'm getting the name of the object, not the value? Then how do I get the value correctly? Confused, it seems.
 
artmedia70:

It's interesting... ObjectFind(); returns chart subwindow number

:) I was reading the help too :)

There are text objects, I need to compare them (numbers). How?

One indicator draws a table and the other one has to calculate it.

 
Abzasc:
Maybe because I'm getting the name of the object, not the value? Then how do I get the value correctly? Confused, it seems.
You are comparing the sub-window numbers in which the objects are drawn. If in one, the function ObjectFind(); returns the number of that window and it will be the same for the two values being compared. Thus you are comparing window numbers. And most likely the same window with itself...
 
Abzasc:

:) I was reading the help too :)

There are text objects, I need to compare them (numbers). How?

Numbers of what? Can you be more specific?
Reason: