코딩 도움말 - 페이지 405

 
Tomcat98:
안녕 믈라덴

Multi_Indic_00이 오실레이터이고 Up_Prime_00이 정의 레벨인 보류 중인 주문에 대해 루프가 말하는 내용은 다음과 같습니다.

//+----------------------------------------------- ----------------------+

//---- 주문 유형이 제한이고 추세가 변경된 경우 확인하고 닫습니다.

if(주문 유형()==OP_BUYLIMIT)

if(( Multi_Indic_00 ) <= (Up_Prime_00 ))

{

_OrderDelete=OrderDelete(주문 티켓());

}

if(주문 유형()==OP_SELLLIMIT)

if(( Multi_Indic_00 ) >= ( Down_Prime_00 ))

{

_OrderDelete=OrderDelete(주문 티켓());

}

//+----------------------------------------------- ----------------------+

뭐 특별한건 없습니다....

즐거운 거래.

감사합니다.

톰캣98

톰캣98

내가 보고 싶은 것은 for() 루프 문입니다. 다음과 같은 for 문이 있는 경우:

(int i = 0; i < OrdersTotal(); i++)

그 사이에 일부 주문이 마감되거나 삭제된 경우 일부 주문이 누락됩니다. 반면에 for() 루프가 다음과 같이 진행되는 경우:

for (int i = OrdersTotal()-1, i >= 0, i--)

그런 다음 모든 주문을 처리합니다.

 

믈라덴 ,

알겠어요:

닫기 프로세스는 다음과 같습니다.

"

for(int i=0;i<OrdersTotal();i++)

{

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) 중단;

if(OrderMagicNumber()!=MAGIC || OrderSymbol()!=Symbol()) 계속;

"

톰캣98

 
Tomcat98:
믈라덴 ,

알겠어요:

닫기 프로세스는 다음과 같습니다.

"

for(int i=0;i<OrdersTotal();i++)

{

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) 중단;

if(OrderMagicNumber()!=MAGIC || OrderSymbol()!=Symbol()) 계속;

"

톰캣98

톰캣98

루프를 다음으로 변경

for(int i=OrdersTotal()-1;i>=0;i--)

그리고 괜찮을거야

 

믈라덴,

빙고!

이제 정확히 내가 필요로 하는 작업을 수행합니다.

큰 도움을 주셔서 대단히 감사합니다.

"사람들은 당신이 얼마나 관심을 갖고 있는지 알기 전까지는 당신이 얼마나 알고 있는지 신경 쓰지 않습니다."

― 시어도어 루즈벨트

감사합니다.

톰캣98

 
Tomcat98:
믈라덴,

빙고!

이제 정확히 내가 필요로 하는 작업을 수행합니다.

큰 도움을 주셔서 대단히 감사합니다.

"사람들은 당신이 얼마나 관심을 갖고 있는지 알기 전까지는 당신이 얼마나 알고 있는지 신경 쓰지 않습니다."

― 시어도어 루즈벨트

감사합니다.

톰캣98

행복한 코딩

 

안녕하세요 Mladen, 모든 일에 감사드립니다.

이제 다시 로드되지 않는 표시기가 생성되어 촛불이 닫힐 때마다 표시기를 다시 로드해야 합니다. 이 문제를 해결하는 데 도움을 줄 수 있나요? 다음은 코드의 일부입니다(간단한 아이디어를 기반으로 한 추세 표시기입니다. 감사합니다.

#property copyright "Copyright © 2014 Daniel Luchinger"

#속성링크

#속성엄격

#속성엄격

#속성 표시기_차트_창

#속성 표시기_버퍼 4

#property indicator_color1 clrLime

#property indicator_color2 clrRed

#property indicator_color3 clr마젠타

#property indicator_color4 clrCyan

#define 구매 1

#define 판매 2

이중 구매[],

팔다[],

우선구매[],

첫 판매[];

int OnInit() {

SetIndexBuffer(0,FirstBuy);

SetIndexBuffer(1,FirstSell);

SetIndexBuffer(2,구매);

SetIndexBuffer(3,판매);

for(int i=0; i<4; i++) {

SetIndexStyle(i,DRAW_ARROW,STYLE_SOLID,2);}

SetIndexArrow(0,233);

SetIndexArrow(1,234);

SetIndexArrow(2,233);

SetIndexArrow(3,234);

반환(INIT_SUCCEEDED);}

무효 OnDeinit(const int 이유) {}

int OnCalculate(const int rate_total, const int prev_calculated, const datetime &time[],

const 이중 &open[], const 이중 &high[], const 이중 &low[],

const double &close[], const long &tick_volume[], const long &volume[],

const int &spread[]) {

정적 정수 lastSignal = 0;

for(int i=MathMin(rates_total-prev_calculated, Rates_total-1); i>=0; i--) {

FirstBuy=FirstSell=구매=판매=EMPTY_VALUE;

datetime when=시간;

if((고가)<0) {

if(lastSignal==판매) {

FirstBuy=종료;

SoundAlert(때,"구매");}

lastSignal=구매;}

if((낮은 닫기)>0){

if(lastSignal==구매) {

FirstSell=종료;

SoundAlert(때,"판매");}

lastSignal=판매;}

}

반환(요금 합계);}

무효 SoundAlert(날짜 시간 i, 문자열 디렉토리) {

정적 날짜/시간 lastAlert=0;

if(lastAlert!=i) {

Alert(StringFormat("%s 신호가 %s의 %s에 있음",dir,Symbol(),TimeToStr(i)));

 
daniel1983:
안녕하세요 Mladen, 모든 일에 감사드립니다.

이제 다시 로드되지 않는 표시기가 생성되어 촛불이 닫힐 때마다 표시기를 다시 로드해야 합니다. 이 문제를 해결하는 데 도움을 줄 수 있나요? 다음은 코드의 일부입니다(간단한 아이디어를 기반으로 한 추세 표시기입니다. 감사합니다.

#property copyright "Copyright © 2014 Daniel Luchinger"

#속성링크

#속성엄격

#속성엄격

#속성 표시기_차트_창

#속성 표시기_버퍼 4

#property indicator_color1 clrLime

#property indicator_color2 clrRed

#property indicator_color3 clr마젠타

#property indicator_color4 clrCyan

#define 구매 1

#define 판매 2

이중 구매[],

팔다[],

우선구매[],

첫 판매[];

int OnInit() {

SetIndexBuffer(0,FirstBuy);

SetIndexBuffer(1,FirstSell);

SetIndexBuffer(2,구매);

SetIndexBuffer(3,판매);

for(int i=0; i<4; i++) {

SetIndexStyle(i,DRAW_ARROW,STYLE_SOLID,2);}

SetIndexArrow(0,233);

SetIndexArrow(1,234);

SetIndexArrow(2,233);

SetIndexArrow(3,234);

반환(INIT_SUCCEEDED);}

무효 OnDeinit(const int 이유) {}

int OnCalculate(const int rate_total, const int prev_calculated, const datetime &time[],

const 이중 &open[], const 이중 &high[], const 이중 &low[],

const double &close[], const long &tick_volume[], const long &volume[],

const int &spread[]) {

정적 정수 lastSignal = 0;

for(int i=MathMin(rates_total-prev_calculated, Rates_total-1); i>=0; i--) {

FirstBuy=FirstSell=구매=판매=EMPTY_VALUE;

datetime when=시간;

if((고가)<0) {

if(lastSignal==판매) {

FirstBuy=종료;

SoundAlert(때,"구매");}

lastSignal=구매;}

if((낮은 닫기)>0){

if(lastSignal==구매) {

FirstSell=종료;

SoundAlert(때,"판매");}

lastSignal=판매;}

}

반환(요금 합계);}

무효 SoundAlert(날짜 시간 i, 문자열 디렉토리) {

정적 날짜/시간 lastAlert=0;

if(lastAlert!=i) {

Alert(StringFormat("%s 신호가 %s의 %s에 있음",dir,Symbol(),TimeToStr(i)));

다니엘1983

다음과 같이 시도하십시오.

#property copyright "Copyright © 2014 Daniel Luchinger"

#property link ""

#property strict

#property strict

#property indicator_chart_window

#property indicator_buffers 4

#property indicator_color1 clrLime

#property indicator_color2 clrRed

#property indicator_color3 clrMagenta

#property indicator_color4 clrCyan

#define BUY 1

#define SELL 2

double Buy[],

Sell[],

FirstBuy[],

FirstSell[];

int OnInit() {

SetIndexBuffer(0,FirstBuy);

SetIndexBuffer(1,FirstSell);

SetIndexBuffer(2,Buy);

SetIndexBuffer(3,Sell);

for(int i=0; i<4; i++) {

SetIndexStyle (i,DRAW_ARROW,STYLE_SOLID,2);}

SetIndexArrow (0,233);

SetIndexArrow (1,234);

SetIndexArrow (2,233);

SetIndexArrow (3,234);

return(INIT_SUCCEEDED);}

void OnDeinit(const int reason) {}

int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[],

const double &open[], const double &high[], const double &low[],

const double &close[], const long &tick_volume[], const long &volume[],

const int &spread[]) {

static int lastSignal=0;

for(int i=MathMin(rates_total-prev_calculated, rates_total-2); i>=0; i--)

{

FirstBuy=FirstSell=Buy=Sell=EMPTY_VALUE;

datetime when=Time;

if((High-Close)<0) {

if(lastSignal==SELL) {

FirstBuy=Close;

SoundAlert(when,"Buy");}

lastSignal=BUY;}

if((Low-Close)>0){

if(lastSignal==BUY) {

FirstSell=Close;

SoundAlert(when,"Sell");}

lastSignal=SELL;}

}

return(rates_total);

}

void SoundAlert(datetime i, string dir) {

static datetime lastAlert=0;

if(lastAlert!=i) {

Alert(StringFormat("%s signal on %s at %s",dir,Symbol(),TimeToStr(i)));

}

}

 

안녕하세요 Mladen님, 감사합니다. 하지만 이런 식으로 코드를 작성하고 있습니다. 누락된 신호가 있습니다. 일일 차트 USDJPY에서 비교하는 사진을 만들어 보았습니다.

이것이 무엇일 수 있습니까?

파일:
 
daniel1983:
안녕하세요 Mladen님, 감사합니다. 하지만 이런 식으로 코드를 작성하고 있습니다. 누락된 신호가 있습니다. 일일 차트 USDJPY에서 비교하는 사진을 만들어 보았습니다.

이것이 무엇일 수 있습니까?

다니엘1983

코드에서 미래 값을 사용했습니다(다음:

고가- 종가

낮음- 닫기

나는 일반적인 이전 값인 Close를 사용했습니다. 로 변경하지만 다시 칠해집니다.

 

친애하는 mrtools와 mladen

아무도 도울 수 있습니까? Tom Demark 이동 평균은 내 전략의 핵심 지표이지만 경보는 새 선반이 표시될 때 매우 유용합니다. 알람이 표시기에 코딩될 수 있다면 매우 감사할 것입니다. 당신의 친절한 도움을 기대합니다.

많은 감사