Lot reset butonu yapmaya çalışıyorum ama bundan çokdaha iyi sonuç almam gerekiyor ama yapamıyorum. ( Tüm ea'ları ve göstergeleri sevmiyorum çünkü hepsi bu gibi çok çirkin. )
Yardım edebilecek ve bana iyi tavsiyelerde bulunabilecek sizden iki şeye ihtiyacım var, lütfen gerçekten yardımınıza ihtiyacım var. Çok zaman harcadım ve kodumla ilgili sorunun ne olduğunu anlayamıyorum.
Şimdiden teşekkürler.
//--- ikinci kez düzenlendi - bu yorumu yazarken belki erteliyordum...
ObjectCreate ( 0 , "button lot reset" , OBJ_BUTTON , 0 , 0 , 0 ); ObjectSetString ( 0 , "button lot reset" , OBJPROP_TEXT , "x" ); ObjectSetString ( 0 , "button lot reset" , OBJPROP_FONT , "Verdana" ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_FONTSIZE , 14 ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_XDISTANCE , 16 ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_YDISTANCE , 16 ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_XSIZE , 18 ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_YSIZE , 18 ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_CORNER , CORNER_LEFT_UPPER ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_COLOR , White ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_BGCOLOR , Black ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_BORDER_COLOR , Black ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_STATE , false ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_BACK , false ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_SELECTABLE , false ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_SELECTED , false ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_HIDDEN , true ); ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_ZORDER , true );
//+------------------------------------------------------------------+ //| Create the button | //+------------------------------------------------------------------+ bool ButtonCreate( constlong chart_ID= 0 , // chart's ID conststring name= "Button" , // button name constint sub_window= 0 , // subwindow index constint x= 0 , // X coordinate constint y= 0 , // Y coordinate constint width= 50 , // button width constint height= 18 , // button height constENUM_BASE_CORNER corner= CORNER_LEFT_UPPER , // chart corner for anchoring conststring text= "Button" , // text conststring font= "Arial" , // font constint font_size= 10 , // font size constcolor clr= clrBlack , // text color constcolor back_clr= C'236,233,216' , // background color constcolor border_clr= clrNONE , // border color constbool state= false , // pressed/released constbool back= false , // in the background constbool selection= false , // highlight to move constbool hidden= true , // hidden in the object list constlong z_order= 0 ) // priority for mouse click { //--- reset the error value ResetLastError (); //--- create the button if (! ObjectCreate (chart_ID,name, OBJ_BUTTON ,sub_window, 0 , 0 )) { Print ( __FUNCTION__ , ": failed to create the button! Error code = " , GetLastError ()); return ( false ); } //--- set button coordinates ObjectSetInteger (chart_ID,name, OBJPROP_XDISTANCE ,x); ObjectSetInteger (chart_ID,name, OBJPROP_YDISTANCE ,y); //--- set button size ObjectSetInteger (chart_ID,name, OBJPROP_XSIZE ,width); ObjectSetInteger (chart_ID,name, OBJPROP_YSIZE ,height); //--- set the chart's corner, relative to which point coordinates are defined ObjectSetInteger (chart_ID,name, OBJPROP_CORNER ,corner); //--- set the text ObjectSetString (chart_ID,name, OBJPROP_TEXT ,text); //--- set text font ObjectSetString (chart_ID,name, OBJPROP_FONT ,font); //--- set font size ObjectSetInteger (chart_ID,name, OBJPROP_FONTSIZE ,font_size); //--- set text color ObjectSetInteger (chart_ID,name, OBJPROP_COLOR ,clr); //--- set background color ObjectSetInteger (chart_ID,name, OBJPROP_BGCOLOR ,back_clr); //--- set border color ObjectSetInteger (chart_ID,name, OBJPROP_BORDER_COLOR ,border_clr); //--- display in the foreground (false) or background (true) ObjectSetInteger (chart_ID,name, OBJPROP_BACK ,back); //--- set button state ObjectSetInteger (chart_ID,name, OBJPROP_STATE ,state); //--- enable (true) or disable (false) the mode of moving the button by mouse ObjectSetInteger (chart_ID,name, OBJPROP_SELECTABLE ,selection); ObjectSetInteger (chart_ID,name, OBJPROP_SELECTED ,selection); //--- hide (true) or display (false) graphical object name in the object list ObjectSetInteger (chart_ID,name, OBJPROP_HIDDEN ,hidden); //--- set the priority for receiving the event of a mouse click in the chart ObjectSetInteger (chart_ID,name, OBJPROP_ZORDER ,z_order); //--- successful execution return ( true ); } //+------------------------------------------------------------------+
Lütfen, butonları oluşturmak için 'olduğu gibi' belgelerdeki işlevi kullanabilirsiniz, sadece kodunuzun altına ekleyin ve işlevi çağırabilir ve parametreleri iletebilirsiniz.
Teşekkürler düzelttim, sadece bir hataydı. --------------------------------------------
Marco vd Heijden :
Lütfen, butonları oluşturmak için 'olduğu gibi' belgelerdeki işlevi kullanabilirsiniz, sadece kodunuzun altına ekleyin ve işlevi çağırabilir ve parametreleri iletebilirsiniz.
O zaman sadece arayabilirsin:
ButtonCreate(...)
Bana çok yardımcı olacak teşekkürler Marco ve EA'mın kodları temizlenmiş gibi görünüyor. Ayrıca aşağıdaki kodu sormam gerekiyor, nedir, nasıl çalışır?(ben de okudum ama tam anlayamadım)
Lütfen biraz daha açıklayın, şimdiden teşekkürler.
ObjectSetString ( 0 , name, OBJPROP_TOOLTIP , tip );
-------------------------------------------
Ayrıca aşağıdaki kod gibi bool yerine void kullanmam gerekiyor, hangisi iyi?
İşlev, düğme oluşturmanın başarılı olup olmamasına bağlı olarak doğru veya yanlış döndürür, bu nedenle düğmenin gerçekten oluşturulduğunu doğrulamak isteyip istemediğiniz size bağlıdır.
İkinci soru için araç ipucu, farenizi grafikteki nesnenin üzerine getirdiğinizde görünen şeydir.
Şu anda çalışma şeklinizin sınırlamaları var.
Genişletmek istiyorsanız lütfen aşağıdaki makaleleri okuyun:
İşlev, düğme oluşturmanın başarılı olup olmamasına bağlı olarak doğru veya yanlış döndürür, bu nedenle düğmenin gerçekten oluşturulduğunu doğrulamak isteyip istemediğiniz size bağlıdır.
İkinci soru için araç ipucu, farenizi grafikteki nesnenin üzerine getirdiğinizde görünen şeydir.
Şu anda çalışma şeklinizin sınırlamaları var.
Genişletmek istiyorsanız lütfen aşağıdaki makaleleri okuyun:
LotSize simgesi için EA kodumda .PNG dosya biçimini kullanmam gerekiyor. Ama yalnızca .BMP dosya biçimini buldum, bu yüzden biri bana yardım edebilir / bana tavsiyede bulunabilir mi?
Herhangi bir yorum çabucak çok takdir ederse, sadece biraz daha acelem var. Şimdiden teşekkürler.
Lot değeri daha iyiyse, lot değeri 'Durum doğru' veya 'Durum yanlış' olarak yapmaya çalışıyorum. ('Sıfırla' nesnesine tıkladığımda 'durum yanlış'a dönüyorum ve parti boyutunu artırdıktan sonra durum doğru olmuyor)
Aşağıdaki kod yanlış mı?
//| Lot Reset if ( sparam == _namelotRset ) { if ( _lotSize > _lotValue ) { ObjectSetInteger ( 0 , sparam, OBJPROP_STATE , true ); } //---if Close else { ObjectSetInteger ( 0 , sparam, OBJPROP_STATE , false ); } //---if Close _lotSize = _lotValue * _lotMin;
Standard Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_BITMAP - Reference on algorithmic/automated trading language for MetaTrader 5
Lot reset butonu yapmaya çalışıyorum ama bundan çok daha iyi sonuç almam gerekiyor ama yapamıyorum.
( Tüm ea'ları ve göstergeleri sevmiyorum çünkü hepsi bu gibi çok çirkin. )
Yardım edebilecek ve bana iyi tavsiyelerde bulunabilecek sizden iki şeye ihtiyacım var, lütfen gerçekten yardımınıza ihtiyacım var.
Çok zaman harcadım ve kodumla ilgili sorunun ne olduğunu anlayamıyorum.
Şimdiden teşekkürler.
//--- ikinci kez düzenlendi - bu yorumu yazarken belki erteliyordum...
ObjectSetString ( 0 , "button lot reset" , OBJPROP_TEXT , "x" );
ObjectSetString ( 0 , "button lot reset" , OBJPROP_FONT , "Verdana" );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_FONTSIZE , 14 );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_XDISTANCE , 16 );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_YDISTANCE , 16 );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_XSIZE , 18 );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_YSIZE , 18 );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_CORNER , CORNER_LEFT_UPPER );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_COLOR , White );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_BGCOLOR , Black );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_BORDER_COLOR , Black );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_STATE , false );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_BACK , false );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_SELECTABLE , false );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_SELECTED , false );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_HIDDEN , true );
ObjectSetInteger ( 0 , "button lot reset" , OBJPROP_ZORDER , true );
//| Create the button |
//+------------------------------------------------------------------+
bool ButtonCreate( const long chart_ID= 0 , // chart's ID
const string name= "Button" , // button name
const int sub_window= 0 , // subwindow index
const int x= 0 , // X coordinate
const int y= 0 , // Y coordinate
const int width= 50 , // button width
const int height= 18 , // button height
const ENUM_BASE_CORNER corner= CORNER_LEFT_UPPER , // chart corner for anchoring
const string text= "Button" , // text
const string font= "Arial" , // font
const int font_size= 10 , // font size
const color clr= clrBlack , // text color
const color back_clr= C'236,233,216' , // background color
const color border_clr= clrNONE , // border color
const bool state= false , // pressed/released
const bool back= false , // in the background
const bool selection= false , // highlight to move
const bool hidden= true , // hidden in the object list
const long z_order= 0 ) // priority for mouse click
{
//--- reset the error value
ResetLastError ();
//--- create the button
if (! ObjectCreate (chart_ID,name, OBJ_BUTTON ,sub_window, 0 , 0 ))
{
Print ( __FUNCTION__ ,
": failed to create the button! Error code = " , GetLastError ());
return ( false );
}
//--- set button coordinates
ObjectSetInteger (chart_ID,name, OBJPROP_XDISTANCE ,x);
ObjectSetInteger (chart_ID,name, OBJPROP_YDISTANCE ,y);
//--- set button size
ObjectSetInteger (chart_ID,name, OBJPROP_XSIZE ,width);
ObjectSetInteger (chart_ID,name, OBJPROP_YSIZE ,height);
//--- set the chart's corner, relative to which point coordinates are defined
ObjectSetInteger (chart_ID,name, OBJPROP_CORNER ,corner);
//--- set the text
ObjectSetString (chart_ID,name, OBJPROP_TEXT ,text);
//--- set text font
ObjectSetString (chart_ID,name, OBJPROP_FONT ,font);
//--- set font size
ObjectSetInteger (chart_ID,name, OBJPROP_FONTSIZE ,font_size);
//--- set text color
ObjectSetInteger (chart_ID,name, OBJPROP_COLOR ,clr);
//--- set background color
ObjectSetInteger (chart_ID,name, OBJPROP_BGCOLOR ,back_clr);
//--- set border color
ObjectSetInteger (chart_ID,name, OBJPROP_BORDER_COLOR ,border_clr);
//--- display in the foreground (false) or background (true)
ObjectSetInteger (chart_ID,name, OBJPROP_BACK ,back);
//--- set button state
ObjectSetInteger (chart_ID,name, OBJPROP_STATE ,state);
//--- enable (true) or disable (false) the mode of moving the button by mouse
ObjectSetInteger (chart_ID,name, OBJPROP_SELECTABLE ,selection);
ObjectSetInteger (chart_ID,name, OBJPROP_SELECTED ,selection);
//--- hide (true) or display (false) graphical object name in the object list
ObjectSetInteger (chart_ID,name, OBJPROP_HIDDEN ,hidden);
//--- set the priority for receiving the event of a mouse click in the chart
ObjectSetInteger (chart_ID,name, OBJPROP_ZORDER ,z_order);
//--- successful execution
return ( true );
}
//+------------------------------------------------------------------+
Lütfen, butonları oluşturmak için 'olduğu gibi' belgelerdeki işlevi kullanabilirsiniz, sadece kodunuzun altına ekleyin ve işlevi çağırabilir ve parametreleri iletebilirsiniz.
O zaman sadece arayabilirsin:
Ayrıca
Teşekkürler düzelttim, sadece bir hataydı.
--------------------------------------------
Lütfen, butonları oluşturmak için 'olduğu gibi' belgelerdeki işlevi kullanabilirsiniz, sadece kodunuzun altına ekleyin ve işlevi çağırabilir ve parametreleri iletebilirsiniz.
O zaman sadece arayabilirsin:
Bana çok yardımcı olacak teşekkürler Marco ve EA'mın kodları temizlenmiş gibi görünüyor.
Ayrıca aşağıdaki kodu sormam gerekiyor, nedir, nasıl çalışır? (ben de okudum ama tam anlayamadım)
Lütfen biraz daha açıklayın, şimdiden teşekkürler.
-------------------------------------------
Ayrıca aşağıdaki kod gibi bool yerine void kullanmam gerekiyor, hangisi iyi?
// or
void ButtonCreate(...)
İşlev, düğme oluşturmanın başarılı olup olmamasına bağlı olarak doğru veya yanlış döndürür, bu nedenle düğmenin gerçekten oluşturulduğunu doğrulamak isteyip istemediğiniz size bağlıdır.
İkinci soru için araç ipucu, farenizi grafikteki nesnenin üzerine getirdiğinizde görünen şeydir.
Şu anda çalışma şeklinizin sınırlamaları var.
Genişletmek istiyorsanız lütfen aşağıdaki makaleleri okuyun:
https://www.mql5.com/en/search#!keyword=graphical%20interfaces&module=mql5_module_articles
İşlev, düğme oluşturmanın başarılı olup olmamasına bağlı olarak doğru veya yanlış döndürür, bu nedenle düğmenin gerçekten oluşturulduğunu doğrulamak isteyip istemediğiniz size bağlıdır.
İkinci soru için araç ipucu, farenizi grafikteki nesnenin üzerine getirdiğinizde görünen şeydir.
Şu anda çalışma şeklinizin sınırlamaları var.
Genişletmek istiyorsanız lütfen aşağıdaki makaleleri okuyun:
https://www.mql5.com/en/search#!keyword=graphical%20interfaces&module=mql5_module_articles
Kocaman teşekkürler.
Vay canına, adamım olacaksın, Bay Marco.
(ilk yorumunuzdan beri - bana çok yardımcı oldunuz - her zaman endişelerimi anlamaya çalışıyorsunuz - bir kez daha çok teşekkürler)
LotSize simgesi için EA kodumda .PNG dosya biçimini kullanmam gerekiyor.
Ama yalnızca .BMP dosya biçimini buldum, bu yüzden biri bana yardım edebilir / bana tavsiyede bulunabilir mi?
Herhangi bir yorum çabucak çok takdir ederse, sadece biraz daha acelem var.
Şimdiden teşekkürler.
Lot değeri daha iyiyse, lot değeri 'Durum doğru' veya 'Durum yanlış' olarak yapmaya çalışıyorum.
('Sıfırla' nesnesine tıkladığımda 'durum yanlış'a dönüyorum ve parti boyutunu artırdıktan sonra durum doğru olmuyor)
Aşağıdaki kod yanlış mı?
if ( sparam == _namelotRset )
{
if ( _lotSize > _lotValue )
{
ObjectSetInteger ( 0 , sparam, OBJPROP_STATE , true );
} //---if Close
else
{
ObjectSetInteger ( 0 , sparam, OBJPROP_STATE , false );
} //---if Close
_lotSize = _lotValue * _lotMin;
_infoUpdate();
return ;
} //---if Close
Teşekkürler!
//--- ikinci kez düzenlendi
Aşağıdaki kodla ' ON OFF ' açmaya çalışıyorum.
Bakınız:
https://www.mql5.com/en/docs/constants/objectconstants/enum_object/obj_bitmap
Bitmap sorunu için.
Ve diğer sorun için, durumu sparamın dışına ayarlamak için onu ayrı parçalara ayırabilirsiniz.