gustavo.alonso:
....
Eu faço assim geralmente.
Acho que haja maneiras mais triviais de se fazer isso, mas atende perfeitamente a copia dos valores do zig zag.
#include <Trade\SymbolInfo.mqh> CSymbolInfo m_symbol; int handle; datetime m_start_time; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { if(!m_symbol.Name(Symbol())) // sets symbol name return(INIT_FAILED); m_start_time=D'2020.01.01 00:00:00'; handle=iCustom(Symbol(),Period(),"Examples\\ZigZag"); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- double high_0 = 0.0; double high_1 = 0.0; double low_0 = 0.0; double low_1 = 0.0; if(!SearchExtremes(high_0,low_0,high_1,low_1, 0)) return; Print("high_0: ", high_0, " low_0: ", low_0, " high_1: ", high_1, " low_1: ", low_1); } //+------------------------------------------------------------------+ bool SearchExtremes(double &high_0,double &low_0,double &high_1,double &low_1, int index) { if(BarsCalculated(handle)==-1) return(false); double zigzag[]; ArraySetAsSeries(zigzag,true); int copied=CopyBuffer(handle, index, TimeCurrent(), m_start_time,zigzag); if(copied==-1) return(false); int size=ArraySize(zigzag); double vertex_0=0.0,vertex_1=0.0,vertex_2=0.0,vertex_3=0.0; for(int i=0; i<size; i++) { if(zigzag[i]!=0) { if(vertex_0==0.0) { vertex_0=zigzag[i]; continue; } if(vertex_1==0.0) { vertex_1=zigzag[i]; continue; } if(vertex_2==0.0) { vertex_2=zigzag[i]; continue; } if(vertex_3==0.0) { vertex_3=zigzag[i]; //--- save memory: remember the number of copied items datetime temp=iTime(m_symbol.Name(),Period(),i); if(temp==D'1970.01.01 00:00:00') return(false); m_start_time=temp; break; } } } //--- if(vertex_0!=0.0 && vertex_1!=0.0 && vertex_2!=0.0 && vertex_3!=0.0) { high_0=0.0; low_0=0.0; high_1=0.0; low_1=0.0; if(vertex_0>vertex_1) { high_0 = vertex_0; low_0 = vertex_1; high_1 = vertex_2; low_1 = vertex_3; int d=0; return(true); } else { low_0 = vertex_0; high_0 = vertex_1; low_1 = vertex_2; high_1 = vertex_3; int d=0; return(true); } } //--- m_start_time=m_start_time-100; return(false); }
Jonathan Pereira:
Eu faço assim geralmente.
Acho que haja maneiras mais triviais de se fazer isso, mas atende perfeitamente a copia dos valores do zig zag.
muito obrigado vou estudar esse codigo, vlwww

Você está perdendo oportunidades de negociação:
- Aplicativos de negociação gratuitos
- 8 000+ sinais para cópia
- Notícias econômicas para análise dos mercados financeiros
Registro
Login
Você concorda com a política do site e com os termos de uso
Se você não tem uma conta, por favor registre-se
Boa tarde Pessoal,
estou criando um indicador usando o ZigZag para marcar pivos, chamo o ZigZig através do iCustom(), e copio os buffers dele , porém ao fazer um plot simples percebi que pontos que o zigzag havia marcado e depois recalculou ainda permanecem marcados alguém tem uma ideia de como resolver isso?
mandei uma imagem junto as bolinhas são do meu indicador o zigzag é do proprio zigzag coloquei para facilitar o entendimento.