Советник GralSystem

maksimkawasaki

Интересующийся
значит советник ло....х . ладно пойду спать, спасибо за совет:loss:
 

fsru212

Новичок форума
[lang=en]Hi...My Brothers...!!!

I THINK IF YOU WANT TO GET RIGHT LOGIC TO FUTURE PREDICT,
DO NOT USE .HST FILE !!!!! OR FILE HISTORY !!!
BECAUSE IT WILL PRODUCE CONFLICT !!! IT CAN NOT WORKS PROPERLY,SO YOU MUST CHANGE CODE OF PROGRAM AND THEN USE BARS FOR ANALYSYS !!
THERE ARE OPPORTUNITY TO MAKE EA WORKS PROPERLY :

STEP 1 : CHANGE IT CODE INTO CUSTOM INDICATOR !!! SO IF WE CAN USE IT WITH LOGIC :
if ( iCustom( NULL,0," Bla..Bla..Bla",0) ==> BUY();
if ( iCustom( NULL,0," Bla..Bla..Bla",0) ==> SELL();

STEP 2 : MAKE EA INDEPENDENTLY AND SEPARATE WITH INDICATOR.

I THINK IT WILL RESOLVE CONFLICT OF THE EA !!

GOOD CODING !!! AND GOOD LUCK !!
:idea:

[/lang]

THE CODE EA PROGRAM TRANSFORM INTO INDICATOR !!!
TRY THIS BELOW !!!

HTML:
#define MAINSEEK 148
#define BARSIZE 44  // LONG_VALUE + 5 * DOUBLE_VALUE

extern int Pips = 50;
extern double Lots = 0.1;

int handle;
bool MainError;

int GetTime( int Pos )
{
  int PosTime;
  
  FileSeek(handle, MAINSEEK + Pos, SEEK_SET);
  PosTime = FileReadInteger(handle);

  return(PosTime);
}

bool FindTimePlace( int SearchTime )
{
  int LeftTime, RightTime, PosTime;
  int Left, Right, Pos;
  
  Left = 0;
  Right = FileSize(handle) - MAINSEEK - BARSIZE;
  
  LeftTime = GetTime(Left);
  RightTime = GetTime(Right);
  
  while ((LeftTime < SearchTime) && (SearchTime < RightTime))
  {    
    Pos = (Left + Right) / 2;
    Pos -= Pos % BARSIZE;
    
    if (Pos == Left)
      break;
    
    PosTime = GetTime(Pos);
    
    if (SearchTime >= PosTime)
    {
      Left = Pos;
      LeftTime = GetTime(Left);
    }
    else // if (SearchTime < PosTime)
    {
      Right = Pos;
      RightTime = GetTime(Right);
    }
  }
  
  if (SearchTime <= RightTime)
  {
    FileSeek(handle, Left + MAINSEEK, SEEK_SET);
    return(TRUE);
  }
  else
    return(FALSE);
}

void init()
{
  handle = FileOpenHistory(Symbol() + Period() + ".hst", FILE_BIN|FILE_READ);
  
  if (handle > 0)
    MainError = TRUE;
  else
  {
    MainError = FALSE;
    
    return;
  }

  MainError = FindTimePlace(Time[0]);
  
  if (!MainError)
    FileClose(handle);
    
  return;
}

void deinit()
{
  if (MainError)
    FileClose(handle);
  
  return;
}

bool GetPrices( int& PriceTime, int& PriceLow, int& PriceHigh)
{
  PriceTime = FileReadInteger(handle);
  FileSeek(handle, DOUBLE_VALUE, SEEK_CUR);
  PriceLow = FileReadDouble(handle) / Point + 0.1;
  PriceHigh = FileReadDouble(handle) / Point + 0.1;
  FileSeek(handle, 2 * DOUBLE_VALUE, SEEK_CUR);

  if (FileTell(handle) + BARSIZE <= FileSize(handle))
    return(TRUE);
  else
    return(FALSE);
}

int GetTimeTrade()
{
  static bool FlagUP = TRUE;
  static int Min = 999999;
  static int Max = 0;
  static int NTime;
  int ResTime;
  
  int PriceTime, PriceLow, PriceHigh;
    
  while (TRUE)
  {
    if (!GetPrices(PriceTime, PriceLow, PriceHigh))
      return(-1);

    if (FlagUP)
    {
      if (PriceHigh > Max)
      {
        Max = PriceHigh;
        NTime = PriceTime;
      }
      else if (Max - PriceLow >= Pips)
      {
        FlagUP = FALSE;
        Min = PriceLow;
        
        break;
      }
    }
    else // (FlagUP == FALSE)
    {
      if (PriceLow < Min)
      {
        Min = PriceLow;
        NTime = PriceTime;
      }
      else if (PriceHigh - Min >= Pips)
      {
        FlagUP = TRUE;
        Max = PriceHigh;
        
        break;
      }
    }
  }
  
  ResTime = NTime;
  NTime = PriceTime;

  return(ResTime);
}

void CloseOrder( int Ticket )
{
  OrderSelect(Ticket, SELECT_BY_TICKET);
  
  if (OrderType() == OP_BUY)
    OrderClose(Ticket, OrderLots(), Bid, 0);
  else  // (OrderType() == OP_SELL)
    OrderClose(Ticket, OrderLots(), Ask, 0);

  return;  
}

int ReverseOrder( int Ticket)
{
  if (Ticket == 0)
    Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 0, 0, 0);
  else
  {
    OrderSelect(Ticket, SELECT_BY_TICKET);
  
    if (OrderType() == OP_BUY)
    {
      OrderClose(Ticket, OrderLots(), Bid, 0);
      Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 0, 0, 0);
    }
    else  // (OrderType() == OP_SELL)
    {
      OrderClose(Ticket, OrderLots(), Ask, 0);
      Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 0, 0, 0);
    }
  }
  
  return(Ticket);
}

void System()
{
  static int Ticket = 0;
  static int NewTime = 0;
  
  if (NewTime < 0)
    return;
    
  if (Time[0] < NewTime)
    return;

  Ticket = ReverseOrder(Ticket);
  
  NewTime = GetTimeTrade();
  
  if (NewTime < 0)
    CloseOrder(Ticket);
}

void start()
{
  if (!MainError)
    return;

  System();
    
  return;
}
 

Ugar

Гуру форума
Что вы так разоряетесь? Ну заглядывает в будущее. Обычный грааль. В основном программисты так прикалываются. Но некоторое это продают лохам.
Почему же так не возмущаетесь когда видите индикаторы заглядывающие в будущее. По сути почти все прорисовывающиеся индикаторы заглядывают в будущее. А люди видят как красиво они показывают развороты пытаются использовать. А некоторые даже покупают.
 

hamkahamzah77

Интересующийся
[lang=en]
[lang=en]Hi...My Brothers...!!!

I THINK IF YOU WANT TO GET RIGHT LOGIC TO FUTURE PREDICT,
DO NOT USE .HST FILE !!!!! OR FILE HISTORY !!!
BECAUSE IT WILL PRODUCE CONFLICT !!! IT CAN NOT WORKS PROPERLY,SO YOU MUST CHANGE CODE OF PROGRAM AND THEN USE BARS FOR ANALYSYS !!
THERE ARE OPPORTUNITY TO MAKE EA WORKS PROPERLY :

STEP 1 : CHANGE IT CODE INTO CUSTOM INDICATOR !!! SO IF WE CAN USE IT WITH LOGIC :
if ( iCustom( NULL,0," Bla..Bla..Bla",0) ==> BUY();
if ( iCustom( NULL,0," Bla..Bla..Bla",0) ==> SELL();

STEP 2 : MAKE EA INDEPENDENTLY AND SEPARATE WITH INDICATOR.

I THINK IT WILL RESOLVE CONFLICT OF THE EA !!

GOOD CODING !!! AND GOOD LUCK !!
:idea:

[/lang]

THE CODE EA PROGRAM TRANSFORM INTO INDICATOR !!!
TRY THIS BELOW !!!

HTML:
#define MAINSEEK 148
#define BARSIZE 44  // LONG_VALUE + 5 * DOUBLE_VALUE

extern int Pips = 50;
extern double Lots = 0.1;

int handle;
bool MainError;

int GetTime( int Pos )
{
  int PosTime;
  
  FileSeek(handle, MAINSEEK + Pos, SEEK_SET);
  PosTime = FileReadInteger(handle);

  return(PosTime);
}

bool FindTimePlace( int SearchTime )
{
  int LeftTime, RightTime, PosTime;
  int Left, Right, Pos;
  
  Left = 0;
  Right = FileSize(handle) - MAINSEEK - BARSIZE;
  
  LeftTime = GetTime(Left);
  RightTime = GetTime(Right);
  
  while ((LeftTime < SearchTime) && (SearchTime < RightTime))
  {    
    Pos = (Left + Right) / 2;
    Pos -= Pos % BARSIZE;
    
    if (Pos == Left)
      break;
    
    PosTime = GetTime(Pos);
    
    if (SearchTime >= PosTime)
    {
      Left = Pos;
      LeftTime = GetTime(Left);
    }
    else // if (SearchTime < PosTime)
    {
      Right = Pos;
      RightTime = GetTime(Right);
    }
  }
  
  if (SearchTime <= RightTime)
  {
    FileSeek(handle, Left + MAINSEEK, SEEK_SET);
    return(TRUE);
  }
  else
    return(FALSE);
}

void init()
{
  handle = FileOpenHistory(Symbol() + Period() + ".hst", FILE_BIN|FILE_READ);
  
  if (handle > 0)
    MainError = TRUE;
  else
  {
    MainError = FALSE;
    
    return;
  }

  MainError = FindTimePlace(Time[0]);
  
  if (!MainError)
    FileClose(handle);
    
  return;
}

void deinit()
{
  if (MainError)
    FileClose(handle);
  
  return;
}

bool GetPrices( int& PriceTime, int& PriceLow, int& PriceHigh)
{
  PriceTime = FileReadInteger(handle);
  FileSeek(handle, DOUBLE_VALUE, SEEK_CUR);
  PriceLow = FileReadDouble(handle) / Point + 0.1;
  PriceHigh = FileReadDouble(handle) / Point + 0.1;
  FileSeek(handle, 2 * DOUBLE_VALUE, SEEK_CUR);

  if (FileTell(handle) + BARSIZE <= FileSize(handle))
    return(TRUE);
  else
    return(FALSE);
}

int GetTimeTrade()
{
  static bool FlagUP = TRUE;
  static int Min = 999999;
  static int Max = 0;
  static int NTime;
  int ResTime;
  
  int PriceTime, PriceLow, PriceHigh;
    
  while (TRUE)
  {
    if (!GetPrices(PriceTime, PriceLow, PriceHigh))
      return(-1);

    if (FlagUP)
    {
      if (PriceHigh > Max)
      {
        Max = PriceHigh;
        NTime = PriceTime;
      }
      else if (Max - PriceLow >= Pips)
      {
        FlagUP = FALSE;
        Min = PriceLow;
        
        break;
      }
    }
    else // (FlagUP == FALSE)
    {
      if (PriceLow < Min)
      {
        Min = PriceLow;
        NTime = PriceTime;
      }
      else if (PriceHigh - Min >= Pips)
      {
        FlagUP = TRUE;
        Max = PriceHigh;
        
        break;
      }
    }
  }
  
  ResTime = NTime;
  NTime = PriceTime;

  return(ResTime);
}

void CloseOrder( int Ticket )
{
  OrderSelect(Ticket, SELECT_BY_TICKET);
  
  if (OrderType() == OP_BUY)
    OrderClose(Ticket, OrderLots(), Bid, 0);
  else  // (OrderType() == OP_SELL)
    OrderClose(Ticket, OrderLots(), Ask, 0);

  return;  
}

int ReverseOrder( int Ticket)
{
  if (Ticket == 0)
    Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 0, 0, 0);
  else
  {
    OrderSelect(Ticket, SELECT_BY_TICKET);
  
    if (OrderType() == OP_BUY)
    {
      OrderClose(Ticket, OrderLots(), Bid, 0);
      Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 0, 0, 0);
    }
    else  // (OrderType() == OP_SELL)
    {
      OrderClose(Ticket, OrderLots(), Ask, 0);
      Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 0, 0, 0);
    }
  }
  
  return(Ticket);
}

void System()
{
  static int Ticket = 0;
  static int NewTime = 0;
  
  if (NewTime < 0)
    return;
    
  if (Time[0] < NewTime)
    return;

  Ticket = ReverseOrder(Ticket);
  
  NewTime = GetTimeTrade();
  
  if (NewTime < 0)
    CloseOrder(Ticket);
}

void start()
{
  if (!MainError)
    return;

  System();
    
  return;
}



hello friend..
can u post mq4.. i not understant how to use it..
thank[/lang]
 

torito

Интересующийся
Эй, ребята ... это АН только для backtester потому что самка не торговать на демо-
или реальный счет
 

PhoenixAngel

Прохожий
[langtitle=hu]HungarianGrail by OpusDei[/langtitle]

[lang=hu]This is a good sharp trading.

Lucky Trading.

Best regards,
OpusDei
from Hungary

"I'm a system administrator, if you see me laugh, you save!"[/lang]
 

Вложения

  • HungarianGrail by OpusDei.mq4
    6,5 КБ · Просмотры: 329
  • HungarianGrail by OpusDei.ex4
    5,1 КБ · Просмотры: 153
Верх