//+------------------------------------------------------------------+//| AsctrendBuySellExpert_v1.mq4 code by Newdigital |//| https://www.forex-tsd.com |//| using Gordago software http://www.gordago.com |//| - Asctrend code for this EA was taken from |//| AscTrend_NonLag EA coded by of Igorad. |//| - "Non-Trading Hours" on the screen fixing code by Locutus |//| from Updated DayTradingMM EA |//+------------------------------------------------------------------+#property copyright "newdigital"#property link "https://www.forex-tsd.com"#include <stderror.mqh> // библиотека ошибок#include <stdlib.mqh>externint MAGIC = 100111 ;
externstring PARAMETERS_EXPERT = "PARAMETERS EXPERT" ;
externcolor clOpenBuy = Blue ;
externcolor clCloseBuy = Aqua ;
externcolor clOpenSell = Red ;
externcolor clCloseSell = Violet ;
externcolor clModiBuy = Blue ;
externcolor clModiSell = Red ;
externstring Name_Expert = "AsctrendBuySellExpert" ;
externbool UseSound = False;
externstring NameFileSound = "alert.wav" ;
externstring PARAMETERS_FILTER = "PARAMETERS FILTER" ;
externbool UseHourTrade = False;
externint FromHourTrade = 8 ;
externint ToHourTrade = 18 ;
externstring PARAMETERS_TRADE = "PARAMETERS TRADE" ;
externdouble Lots = 0.10 ;
externint Slippage = 4 ;
externdouble lStopLoss = 1000 ;
externdouble sStopLoss = 1000 ;
externdouble lTakeProfit = 1000 ;
externdouble sTakeProfit = 1000 ;
externdouble lTrailingStop = 1000 ;
externdouble sTrailingStop = 1000 ;
externstring PARAMETERS_INDICATOR_ONE = "ASCTrend" ;
externbool UseASCtrend = True;
externint RISK = 3 ;
int asctrend,asctrend1;
int ASCtrend,ASCtrend1;
void deinit() {
Comment ( "" );
}
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+int start(){
if (UseHourTrade){
if (( Hour ()>=FromHourTrade)&&( Hour ()<=ToHourTrade))
Comment ( "Trading Hours" );
else
{
Comment ( "Non-trading Hours" );
return ( 0 );
}
}
if ( Bars < 100 ){
Print ( "bars less than 100" );
return ( 0 );
}
if (lStopLoss< 10 ){
Print ( "StopLoss less than 10" );
return ( 0 );
}
if (lTakeProfit< 10 ){
Print ( "TakeProfit less than 10" );
return ( 0 );
}
if (sStopLoss< 10 ){
Print ( "StopLoss less than 10" );
return ( 0 );
}
if (sTakeProfit< 10 ){
Print ( "TakeProfit less than 10" );
return ( 0 );
}
if (UseASCtrend)
{
ASCtrend = ASCTrend(RISK);
bool ASCtrendBuy = ASCtrend> 0 && ASCtrend1< 0 ;
bool ASCtrendSell = ASCtrend< 0 && ASCtrend1> 0 ;
}
else {ASCtrendBuy = true; ASCtrendSell = true;}
if ( AccountFreeMargin ()<( 1000 *Lots)){
Print ( "We have no money. Free Margin = " , AccountFreeMargin ());
return ( 0 );
}
if (!ExistPositions()){
if ((ASCtrendBuy)){
OpenBuy();
return ( 0 );
}
if ((ASCtrendSell)){
OpenSell();
return ( 0 );
}
}
if (ExistPositions()){
if ( OrderType ()==OP_BUY){
if ((ASCtrendSell)){
CloseBuy();
return ( 0 );
}
}
if ( OrderType ()==OP_SELL){
if ((ASCtrendBuy)){
CloseSell();
return ( 0 );
}
}
}
TrailingPositionsBuy(lTrailingStop);
TrailingPositionsSell(sTrailingStop);
ASCtrend1=ASCtrend;
return ( 0 );
}
bool ExistPositions() {
for ( int i= 0 ; i< OrdersTotal (); i++) {
if ( OrderSelect (i, SELECT_BY_POS, MODE_TRADES)) {
if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==MAGIC) {
return (True);
}
}
}
return (false);
}
void TrailingPositionsBuy( int trailingStop) {
for ( int i= 0 ; i< OrdersTotal (); i++) {
if ( OrderSelect (i, SELECT_BY_POS, MODE_TRADES)) {
if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==MAGIC) {
if ( OrderType ()==OP_BUY) {
if (Bid- OrderOpenPrice ()>trailingStop* Point ) {
if ( OrderStopLoss ()<Bid-trailingStop* Point )
ModifyStopLoss(Bid-trailingStop* Point );
}
}
}
}
}
}
void TrailingPositionsSell( int trailingStop) {
for ( int i= 0 ; i< OrdersTotal (); i++) {
if ( OrderSelect (i, SELECT_BY_POS, MODE_TRADES)) {
if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==MAGIC) {
if ( OrderType ()==OP_SELL) {
if ( OrderOpenPrice ()-Ask>trailingStop* Point ) {
if ( OrderStopLoss ()>Ask+trailingStop* Point || OrderStopLoss ()== 0 )
ModifyStopLoss(Ask+trailingStop* Point );
}
}
}
}
}
}
void ModifyStopLoss( double ldStopLoss) {
bool fm;
fm = OrderModify ( OrderTicket (), OrderOpenPrice (),ldStopLoss, OrderTakeProfit (), 0 , CLR_NONE );
if (fm && UseSound) PlaySound (NameFileSound);
}
void CloseBuy() {
bool fc;
fc= OrderClose ( OrderTicket (), OrderLots (), Bid, Slippage, clCloseBuy);
if (fc && UseSound) PlaySound (NameFileSound);
}
void CloseSell() {
bool fc;
fc= OrderClose ( OrderTicket (), OrderLots (), Ask, Slippage, clCloseSell);
if (fc && UseSound) PlaySound (NameFileSound);
}
void OpenBuy() {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = GetStopLossBuy();
ldTake = GetTakeProfitBuy();
lsComm = GetCommentForOrder();
BroCoOrderSend( Symbol (),OP_BUY,ldLot,Ask,Slippage,ldStop,ldTake,lsComm,MAGIC, 0 ,clOpenBuy);
if (UseSound) PlaySound (NameFileSound);
}
void OpenSell() {
double ldLot, ldStop, ldTake;
string lsComm;
ldLot = GetSizeLot();
ldStop = GetStopLossSell();
ldTake = GetTakeProfitSell();
lsComm = GetCommentForOrder();
BroCoOrderSend( Symbol (),OP_SELL,ldLot,Bid,Slippage,ldStop,ldTake,lsComm,MAGIC, 0 ,clOpenSell);
if (UseSound) PlaySound (NameFileSound);
}
string GetCommentForOrder() { return (Name_Expert); }
double GetSizeLot() { return (Lots); }
double GetStopLossBuy() { return (Bid-lStopLoss* Point );}
double GetStopLossSell() { return (Ask+sStopLoss* Point ); }
double GetTakeProfitBuy() { return (Ask+lTakeProfit* Point ); }
double GetTakeProfitSell() { return (Bid-sTakeProfit* Point ); }
int ASCTrend( int risk )
{
double smin, smax, bsmin, bsmax;
int len = 3 + 2 *risk;
smin=Low[Lowest( NULL , 0 ,MODE_LOW,len, 1 )];
smax=High[Highest( NULL , 0 ,MODE_HIGH,len, 1 )];
bsmax = smax-(smax - smin)*( 33.0 -risk)/ 100.0 ;
bsmin = smin+(smax - smin)*( 33.0 -risk)/ 100.0 ;
asctrend = asctrend1;
if (Close[ 1 ]>bsmax) asctrend= 1 ;
if (Close[ 1 ]<bsmin) asctrend=- 1 ;
asctrend1 = asctrend;
return (asctrend);
}
//+------------------------------------------------------------------+//| Функция для работы с дилинговым центром BroCo |//+------------------------------------------------------------------+int BroCoOrderSend( string symbol,
int cmd,
double volume,
double price,
int slippage,
double stoploss,
double takeprofit,
string comment,
int magic,
datetime expiration,
color arrow_color)
{
int ticket = OrderSend (symbol,cmd, volume, price, slippage, 0 , 0 , comment, magic, expiration, arrow_color);
int check = - 1 ;
if (ticket > 0 && (stoploss != 0 || takeprofit != 0 )) {
if (! OrderModify (ticket, price, stoploss, takeprofit,expiration, arrow_color)) {
check = GetLastError ();
if (check != ERR_NO_ERROR) {
Print ( "OrderModify error: " , ErrorDescription(check));
}
}
} else {
check = GetLastError ();
if (check != ERR_NO_ERROR){
Print ( "OrderSend error: " ,ErrorDescription(check));
}
}
return (ticket);
}
//----------------------------------------------------------------
안녕하세요 여러분! 얘들 아, 나는 asctrend 지표에서 일하는 오래된 Expert Advisor를 만났습니다. 나는 오랫동안이 지표가 실시간으로 어떻게 작동하는지 확인하고 싶었지만 항상 포인트를 추적하는 것이 가능하지 않으며 거래의 그림이 완전하지 않습니다 . 테스터에서 확인해보니 점이 나올때마다 시그널이 있는데 데모에 올려보니 데모에서는 시그널을 건너뛰는 현상이 있는데 전문가는 로그에 아무것도 안쓰는데 찔끔찔끔 코드에서 주위를 둘러보고 걸림돌이 무엇인지 이해하지 못했습니다.
코드가 긴 녀석들! 다른 사람의 코드는 무엇보다도 아직 해독되지 않은 암호라는 것을 다시 한 번 반복하고 싶습니다! 그리고 이것은 작은 작업이 아닙니다! 일부 프로그래머가 목록 킬로미터를 탐구하고 싶어할 것이라고 생각하십니까? 제 코드를 여러분 중 한 명에게 3천 줄만 주고 이 코드에 대한 작은 오해를 없애달라고 요청하겠습니다. 그냥 내 아이디어를 탐구하고 싶다고 생각하세요? 또 의심합니다. 그러므로 나는 당신에게 소원이 있습니다 - 핵심 질문을 할 때 가능한 한 간략하게 문제를 설명하고 동시에 본질을 이해할 수 있도록 설명을 충분하게 만드십시오. 그렇지 않으면, 당신의 외침은 허공에 대한 외침입니다. 코드는 게시물에 첨부할 수 있습니다. 이 모든 것이 필요하고 충분합니다.
모두를 환영합니다!
이 문제를 도와주세요. 새 막대 가 나타날 때 표시기를 강제로 다시 그릴 수 없습니다(간격 D). 피
수동으로 다시 시작해야 합니다.
zlliot 파도에 대한 지표를 다운로드 할 수 있습니까?
물론 당신은 할 수. 찾아서 다운로드해야 합니다.
질리엇 웨이브 지표 사이트:mql4.com
감사합니다 splxgf!!!!!!!!!!!!!!!!
특히 여기에서 ( OrderType( )==OP_BUY && OrderType( )==OP_SELL )
음, 물론 주문은 구매와 판매 모두 가능하지만 ||
르주!! 예, 나는 차를 몰았습니다 ... 현물 ..
if (NormalizeDouble(OrderClosePrice()-OrderTakeProfit(), Digits)<0.5*포인트)
포인트가 누구이며 왜 0.5를 곱하는지 명확히 하는 것이 좋습니다. 예, normalize double이 없는 옵션은 0과 비교할 때 그다지 신뢰할 수 없습니다. 여기에서 작동합니다.
티켓 은 정수 유형 이고 OrderClose 부울입니다... 그렇게 하지 않는 것이 좋습니다.
while 루프는 무한하고 시장 주문만 삭제하려고 시도합니다. 보류 중인 주문이 있으면 이 음악은 영원합니다. 감사해요!! !!!!
얘들아 차이점이 뭔지 알려줘????
if(OrderSymbol()!=Symbol())계속;
그리고
if(OrderSymbol()==Symbol())
????????????
예, 잘 모르겠습니다. 계속, 이전 루프로 보내야 하며, 작성 방법에 따라 일치할 때까지 반복될 수 있습니다.
돕다!!!!!!! (이전 페이지의 내 게시물)!
터미널을 다시 설치한 후 MetaEditor가 작동을 멈췄습니다. 표시기 코드에서 아무 것도 변경하지 않은 경우에만 컴파일됩니다. 최소한 선의 색상이라도 무언가가 변경된 경우 오류가 발생합니다.
OS Windows 7. 누군가 비슷한 결함을 발견했을 수 있습니다. 어떻게 해야할지 말해줘?