Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 770

 
Can a price marker be set to a value that differs from the price where it stands? If so, how? I'm slow...
 
TheXpert:
Can a price marker be set to a value that differs from the price where it stands? If so, how? I'm slowing something down...
If we're talking about OBJ_ARROW_LEFT_PRICE or similar right, no, you can't, the displayed value serves at the same time as the vertical coordinate.
 
input double lots = 0.01;
input int takeprofit = 100;
input int stoploss = 100;
input double DeltaPrice = 50;
 extern int magic = 123;
 
//----------------+
int init()
     

{
 if (PRICE_OPEN!=0); 
  else {if PRICE_OPEN = NormalizeDouble(Ask +PRICE_OPEN *DeltaPrice*Point,Digits); 
       else  PRICE_OPEN = NormalizeDouble(Bid - PRICE_OPEN*DeltaPrice*Point,Digits);}       
              
              
             
return(0);
}
int start()
{


int ticket=OrderSend(Symbol(),OP_BUYLIMIT,lots,PRICE_OPEN,3,PRICE_OPEN-stoploss* Point,PRICE_OPEN + takeprofit* Point,NULL,123,120,CLR_NONE);






return(0);
}
 
people help please!!! tell me what's wrong here
 
logut:
people help me please!!! tell me what's wrong here

First explain what it is and what the result of applying this code should be

if (PRICE_OPEN!=0); 
  else {if PRICE_OPEN = NormalizeDouble(Ask +PRICE_OPEN *DeltaPrice*Point,Digits); 
       else  PRICE_OPEN = NormalizeDouble(Bid - PRICE_OPEN*DeltaPrice*Point,Digits);}     

At least open the handbook for a minute...

 

logut:
люди помогите пожалуйста!!! подскажите что у меня здесь не так

input double lots = 0.01;
input int takeprofit = 100;
input int stoploss = 100;
input double DeltaPrice = 50;
 extern int magic = 123;
 
//----------------+
int init()
     

{
 if (PRICE_OPEN!=0); 
  else {if PRICE_OPEN = NormalizeDouble(Ask +PRICE_OPEN *DeltaPrice*Point,Digits); 
       else  PRICE_OPEN = NormalizeDouble(Bid - PRICE_OPEN*DeltaPrice*Point,Digits);}       
              
              
             
return(0);
}
int start()
{


int ticket=OrderSend(Symbol(),OP_BUYLIMIT,lots,PRICE_OPEN,3,PRICE_OPEN-stoploss* Point,PRICE_OPEN + takeprofit* Point,NULL,123,120,CLR_NONE);






return(0);
}

That's it.

I wonder if it really compiles. Somehow I don't believe it. Even without checking, I'd say it shouldn't.

Read what are predefined constants and how they are used, what is L-value and how it differs from R-value.

However, I assume that you need to start with the basics: plenty of links to documentation and tutorial at the top of the site, and the code base is full of examples with source.

 
Which command would the script copy the value to the clipboard?
 
Escapee:
What command would the script use to copy the value to the clipboard?
There aren't any out-of-the-box ones. It's easier to write it to a file, at least there are functions for that(FileWrite).
 
Escapee:

What command would the script use to copy the value to the clipboard?

Only this is for old builds, for new ones you need to modify it. But it's implementable and relatively easy.

#import "user32.dll"
   int OpenClipboard(int notUsed); // BOOL
   int CloseClipboard(); // BOOL
   int EmptyClipboard();  // BOOL
   int SetClipboardData(int format, int hMem); // HANDLE

   int SendMessageA(int hWnd, int Msg, int wParam, int lParam);
   int GetParent(int hWnd);
  
#import "ntdll.dll"
   int memcpy(int dst, string src, int cnt);

   int RtlGetLastWin32Error();
   int RtlSetLastWin32Error(int dwErrCode);

#import "kernel32.dll"
   int GlobalAlloc(int uFlags, int dwBytes); // HGLOBAL
   int GlobalLock(int hMem); // void*
   int GlobalUnlock(int hMem); // HGLOBAL
   int GlobalFree(int hMem); // HGLOBAL
#import

#define  GMEM_MOVEABLE 2
#define  GMEM_ZEROINIT 64

#define  CF_TEXT 1

void PlaceToClipboard(string toCopy)
{
   int size = StringLen(toCopy) + 1;
  
   RtlSetLastWin32Error(0);
   int hMem = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, size);
   if (hMem == 0)
   {
      Print("Alloc failed, error #", RtlGetLastWin32Error());
      return;
   }
  
   RtlSetLastWin32Error(0);
   int ptr = GlobalLock(hMem);
  
   if (ptr == 0)
   {
      Print("Memory lock failed, error #", RtlGetLastWin32Error());
      return;
   }

   memcpy(ptr, toCopy, size);
   GlobalUnlock(hMem);
  
   // now prepare clipboard
  
   int res = OpenClipboard(0);
   if (res == 0)
   {
      Print("Open clipboard failed");
      return;
   }
  
   res = EmptyClipboard();
   if (res == 0)
   {
      Print("Empty clipboard failed");
      CloseClipboard();
      return;
   }
  
   RtlSetLastWin32Error(0);
   res = SetClipboardData(CF_TEXT, hMem);
   if (res == 0)
   {
      Print("Set Data failed, error #", RtlGetLastWin32Error());
   }
   CloseClipboard();

}
 

Help who can. Two-currency Expert Advisor,

If trade conditions are the same, then trade in the first currency is opened.

How to write the "If the order is opened in the first currency OP_BUY, then open a deal in the second OP_SELL

here is an example

if(OrdersTotal()== 1 ) // with this linefor 2 currenciesopens bothBUY andSELL or 2SELLorders

if ( currenttype == OP_BUY ) // it doesn't open at all

if ( currentticket == 1) // it doesn't open likethis either.

secondticket = OrderSend("GBPUSD", OP_SELL, Lots, MarketInfo("GBPUSD", MODE_BID), 2, 0, 0, 0, WindowExpertName(), 0, 0, Red); //Orderfor 2 currencies

if ( c - d > a) //if trade condition is matched,Order for1currency opens perfectly.

currentticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0, "macd sample",Magic,0,Green); //Orderon1currency

Reason: