기계 학습 기술을 이용한 외환 일일 추세 예측


기계적인 Forex.


기계 거래 전략을 사용하여 외환 시장에서 거래합니다.


Forex 무역에서 배우는 기계 : 왜 많은 학자들이 모든 것을 잘못하고 있는지.


실제 시장 상황에서 알맞은 결과를 얻을 수있는 기계 학습 전략 수립은 알고리즘 트레이딩에서 항상 중요한 도전 과제였습니다. 상당한 관심과 놀라운 잠재적 보상에도 불구하고 좋은 기계 학습을 보여줄 수있는 학술지는 아직 없습니다 실제 시장에서 거래 문제를 성공적으로 해결할 수있는 모델 (내가 아는 한 가장 좋은 것은 의견이있을 경우 의견을 게시하고 읽을 수 있다면 기꺼이 할 것입니다.) 출판 된 많은 논문이 유망한 결과를 보여 주지만, 종종 이러한 논문이 다양한 기계적 학습 전략의 실제 시장 성공을 거의 불가능하게 만드는 다양한 통계 편차 문제에 빠지는 경우가 있습니다. 오늘 저는 Forex에서 기계 학습과 관련된 학술 연구에서 볼 수있는 문제점에 대해 이야기하고, 이 연구가 학계 및 거래 커뮤니티 모두에 대해 훨씬 더 유용한 정보를 제공하도록 개선 될 수 있다고 생각합니다.


Forex 거래를 할 때 기계 학습 전략 설계의 함정은 결정 론적 학습 문제의 세계에서 필연적으로 이어집니다. 얼굴 인식이나 문자 인식과 같은 것에 대한 기계 학습 알고리즘을 만들 때 변경되지 않는 잘 정의 된 문제가 있습니다. 일반적으로 데이터의 하위 집합 (훈련 집합)에 기계 학습 모델을 구축 한 다음 if 이 모델은 데이터의 미리 알림 (테스트 세트)을 사용하여 문제를 올바르게 해결할 수있었습니다. 이것이 새로 개발 된 기계 학습 기술의 품질을 확립하는 데 사용할 수있는 유명하고 잘 정립 된 데이터 세트를 보유한 이유입니다. 그러나 여기에서 중요한 점은 초기에 기계 학습에 의해 해결 된 문제는 대부분 결정론적이고 시간에 독립적이라는 점입니다.


거래로 이동할 때, 이 같은 철학을 적용하면 시장의 부분적으로 비 결정 론적 성격과 시간 의존성과 관련된 많은 문제점이 발생합니다. 교육 및 테스트 세트를 선택하려는 단순한 행위는 문제를 야기하는 상당량의 바이어스 (데이터 선택 편향)를 초래합니다. 테스트 세트의 결과를 향상시키기 위해 선택을 반복하면 & # 8211; 적어도 몇 가지 경우에 가정해야합니다. & # 8211; 문제는 또한 많은 양의 데이터 마이닝 편차를 추가합니다. 단일 트레이닝 / 검증 작업을 수행하는 전체 문제는 실시간 거래시이 알고리즘을 적용하는 방법과 관련된 문제도 발생시킵니다. 정의에 따라 실시간 거래는 교육 / 테스트 세트 선택이 다른 데이터에 다시 적용되어야하기 때문에 다릅니다 (이제 테스트 세트는 실제로 알 수없는 데이터 임). 초기 샘플 내 / 샘플 밖 기간 선택에 고유 한 편차와 알 수없는 데이터로 거래하기위한 테스트 된 규칙이 없으면 그러한 기법이 실시간 거래에서 일반적으로 실패하게됩니다. 알고리즘이 2000-2012 년 데이터로 훈련되고 2012-2015 년 데이터로 교차 검증 된 경우 2003-2015 년 데이터에서 교육을 받고 2015 년에서 2017 년까지 트레이드되면 동일한 성공이 일어날 것이라고 믿을만한 이유가 없습니다. 데이터 세트 성격 상 매우 다르다.


측정 알고리즘 성공은 또한 여기에서 매우 관련된 문제입니다. 거래에 사용되는 기계 학습 알고리즘은 필연적으로 긍정적 인 수익을 창출하는 능력으로 측정되어야하지만 일부 문헌은 정확한 예측을 얻을 수있는 능력을 벤치마킹하여 새로운 알고리즘 기법의 장점을 측정합니다. 바이너리 분류자를 만들 때 쉽게 볼 수있는 바와 같이 올바른 예측이 반드시 수익성있는 거래와 같지는 않습니다. 다음 촛불의 방향을 예측하려고하면 작은 양초에 대부분 맞고 큰 양초에 잘못 맞으면 여전히 손실을 입을 수 있습니다. 실제로 이런 종류의 분류 자의 대부분은 & # 8211; 대부분의 사람들은 일을하지 않습니다. & # 8211; 결국 50 % 이상의 정확도로 방향성을 예측하게되지만 수익성있는 바이너리 옵션 거래를 허용하는 커미션을 능가하는 수준을 초과하지는 않습니다.


위의 문제를 대부분 제거한 전략을 수립하기 위해 필자는 항상 기계 학습 알고리즘이 교육 결정을 내리기 전에 재교육되는 방법론을지지했습니다. 트레이닝을 위해 움직이는 창을 사용하고 전체 알고리즘을 재교육하지 않고 하나 이상의 결정을 내리지 않으면 단일 샘플 내 / 샘플 외 세트를 선택할 때 내재 된 선택 바이어스를 제거 할 수 있습니다. 이러한 방식으로 전체 테스트가 일련의 교육 / 검증 연습으로 끝나면 기계 학습 알고리즘이 엄청나게 다른 교육 데이터 세트에서도 작동합니다. 또한 알고리즘을 측정하는 실제 backtesting 성능을 옹호하고 알고리즘의 장점을 배우고 실제로 샘플 밖의 조건에서 입증되지 않은 한 그 알고리즘의 가치가있는 알고리즘은 없다고 말할 것입니다 . 이런 방식으로 알고리즘을 개발하는 것이 훨씬 더 어려워서 이런 유형의 접근법을 따르는 하나의 학술지를 찾지 못했습니다. (내가 코멘트를 포함 할 수 있도록 링크를 게시하는 것을 자유롭게 생각한다면!).


이것은이 방법론이 완전히 문제가 없다는 것을 의미하지는 않지만 커브 피팅 바이어스 및 데이터 마이닝 바이어스를 포함한 모든 전략 구축 연습과 관련된 고전적인 문제에 여전히 노출되어 있습니다. 따라서 많은 양의 데이터를 사용하는 것이 중요합니다 (필자는 각 시스템이 파생 된 결정을 학습 한 후에 항상 시스템을 테스트하고 25 년 이상 시스템을 테스트하는 데 사용함). 적절한 데이터 마이닝 바이어스 평가 테스트를 수행하여 그 결과가 무작위 적으로 발생하지 않는다고 말할 수 있습니다. 내 친구 AlgoTraderJo & # 8211; 누가 또한 내 거래 공동체의 회원이되어. & # 8211; 우리는 무역 커뮤니티를위한 새로운 기계 학습 알고리즘을 개발할 때 기계 학습 개발을위한 이와 같은 유형의 철학을 따르는 ForexFactory에서 현재 스레드를 늘리고 있습니다. 이 방법으로 개발 된 기계 학습 알고리즘의 몇 가지 예를 보려면 내 블로그의 스레드 또는 과거 게시물을 참조 할 수 있습니다.


기계 학습의 발전에 대해 더 알고 싶다면 F4 프레임 워크를 사용하여 자신의 기계 학습 전략을 개발할 수있는 방법을 알아보십시오. 교육 동영상, 거래 시스템, 개발 및 사운드, 정직한 웹 사이트 인 Asirikuy에 가입하십시오. 자동화 된 거래에 대한 투명한 접근.


Forex Trading에서 기계 학습에 대한 5 가지 답변 : 왜 많은 학자가이 모든 일을 잘못하고 있는지 & # 8221;


멋진 기사, 강조하는 문제는 확실히 시스템 견고성에 유효합니다!


내가 가지고있는 질문은 EA가 특정 쌍에서 상당히 잘하고 다른 모든 것들에서 끔찍한 행동을하는 것은 정상적인가요?


또는 강력한 EA는 설정을 변경하지 않고도 적어도 몇 개의 쌍으로 잘 수행되어야합니다!


고마워, 너의 위대한 생각을 위해서.


그 질문은 흥미 롭다.) 나는 한 쌍으로 만 살아남은 시스템이 거래가 진행될 때 수익을 창출 할 수 있느냐하는 질문이 더 낫다고 믿습니다. & # 8221; 대답은 '예'입니다 (이론적으로나 내 자신의 경험에서). 한 쌍으로 만 수익을 얻는다 고해서 시스템이 '불량'하다는 것을 의미하지는 않습니다. 그것은 단순히 하나의 도구에만 존재하는 역사적인 비효율을 악용한다는 것을 의미합니다. 바이어스 소스 (데이터 마이닝 바이어스 및 커브 피팅 바이어스와 같은)를 처리한다면 이것이 작동하지 않을 이유가 없습니다.


이제 여러 기호에서 작동하는 시스템을 사용하는 경우 하나의 기호에서만 작동하는 동일한 시스템에서 데이터 마이닝 편차가 기하 급수적으로 낮아지고 더 많은 데이터를 사용하기 때문에 곡선 피팅 바이어스도 낮아집니다. 그래서 저는 그것이 더 좋다고 말했지만, 꼭 필요하지는 않습니다.


하지만 통계적 편견을 기억하십시오!


나는 당신이 모든 쌍을 가로 질러 이익을 낼 필요가 없다고 말했기 때문에 너무 기쁩니다! 커브 피팅 (curve fitting)은 그것이 적합하기 전에 허용 된 조정의 한계를 어떻게 알 수 있습니까?


마지막으로, MT4에서 가장 일반적인 EA를 사용하여 매우 간단한 테스트를 수행하여 어떤 쌍이 MA에 가장 광범위하게 반응하는지 확인했습니다. 나는 축소와 상관없이 얼마나 많은 '이동 기간'이 (1-20) 사이에 이익을 낼지보기 위해 52 쌍을 역행했다. 나는 당신이 결과를 어떻게 만들지 궁금해했다!


* 5 년 테스트 기간.


* 인출은 측정되지 않습니다.


* 52 개의 쌍이 테스트되었습니다.


* 테스트 된 설정 (기간 1-20).


1 23 쌍, 모든 술집 설정 1-20에서 이익을 내지 않았다.


2 6 쌍, 1 설정에서만 이익을 낼 수 있습니다.


3 14 쌍만, 5 또는 더 많은 다른 설정에서 수익을 반환했습니다.


4 5 쌍만, 10 또는 더 많은 다른 설정에서 수익을 반환했습니다.


1 BTCUSD 19 20 세 사이의 설정이 이익을 창출했습니다.


커브 피팅 바이어스와 데이터 마이닝 바이어스 (또는이 두 가지 유형의 바이어스를 구분할 필요가 있지만이를 호출 할 수도 있습니다)를 구분해야합니다. 커브 피팅 바이어스는 일련의 데이터에서 비효율적 인 부분을 발견함으로써 만들어지는 바이어스입니다. 즉, 시스템에서 일반적인 데이터를 찾거나 사용중인 데이터에 특정한 데이터를 찾는 것입니다. 데이터 마이닝 바이어스는 질문에 답합니다. 즉, 내 시스템이 실제 역사적 비효율을 찾았습니까? 아니면 마이닝 프로세스 (임의의 기회에서 비롯됨) 때문입니까?


매개 변수 공간과 자유도를 늘리면 데이터 마이닝 편차가 증가합니다 (실제로 역사적으로 비효율적 인 시스템이 아닌 우연히 시스템을 찾을 가능성이 높습니다). White의 현실성 검사와 같은 테스트를 사용하여 데이터 마이닝 편향을 측정 할 수 있습니다. 이러한 유형의 테스트를 수행하는 것이 안정적인 전략 설계의 기본입니다.


편향의 차이점에 대한 자세한 내용은 여기를 참조하십시오.


또한 주제에 대한이 신문을 읽으십시오.


트레이딩 시스템 디자인의 복잡성과 트레이딩을위한 전략을 찾기에 앞서 나는 통계학에서 견고한 형성을 얻으 려합니다. (coursera 통계 코스는 훌륭한 무료 시작입니다.) 통계를 통해 자신의 결과를 분석하고 이러한 질문을 체계적으로 처리 할 수있는 능력을 제공합니다 o)


Forex Trading에서 기계 학습 : 왜 많은 학자들이 모든 것을 잘못하고 있습니까 [Mechanical Forex] 실시간 시장 상황에서 적절한 결과를 얻을 수있는 빌딩 기계 학습 전략은 항상 알고리즘 거래에서 중요한 과제였습니다. 엄청난 관심과 엄청난 잠재적 인 보상에도 불구하고 실제 교역 문제를 성공적으로 해결할 수있는 훌륭한 기계 학습 모델을 보여줄 수있는 학술지는 아직 없습니다.


더 나은 전략을 수립하십시오! 4 부 : 기계 학습.


Deep Blue는 체스 세계 선수권에서 우승 한 최초의 컴퓨터였습니다. 그것은 1996 년이었고 다른 프로그램 인 AlphaGo가 최고의 인간형 Go Player를 이길 수있을 때까지 20 년이 걸렸습니다. Deep Blue는 고정 배선 된 체스 규칙이 적용된 모델 기반 시스템이었습니다. AlphaGo는 수천 개의 Go 게임으로 훈련 된 심층 신경 네트워크 인 데이터 마이닝 시스템입니다. 향상된 하드웨어는 아니지만 소프트웨어의 획기적인 기능은 최고의 체스 선수를 물리 치고 톱 Go 플레이어를이기는 단계에서 필수적이었습니다.


미니 시리즈의이 4 번째 부분에서는 거래 전략 개발을위한 데이터 마이닝 접근 방식에 대해 살펴 보겠습니다. 이 방법은 시장 메커니즘에 대해 신경 쓰지 않습니다. 예측 패턴에 대한 가격 곡선 또는 기타 데이터 소스를 검색합니다. 기계 학습 또는 인공 지능 & # 8221; 항상 데이터 마이닝 전략에 관여하지는 않습니다. 사실 가장 인기있는 & # 8211; 놀라 울 정도로 수익성 높은 & # 8211; 데이터 마이닝 방법은 멋진 신경망이나 벡터 머신을 사용하지 않고도 작동합니다.


기계 학습 원리.


학습 알고리즘에는 일반적으로 과거 가격에서 어떤 식 으로든 파생 된 데이터 샘플이 제공됩니다. 각 샘플은 n 개의 변수 x 1 ... x n으로 구성되며 예측 변수 또는 피처라는 이름을 갖습니다. 예측 변수는 마지막 n 개의 막대의 가격 수익률 또는 고전적 지표의 집합 또는 가격 곡선의 상상할 수있는 다른 함수 일 수 있습니다 (저는 신경을위한 예측 변수로 사용되는 가격 차트 이미지 픽셀을 보았습니다) 회로망!). 또한 각 샘플에는 일반적으로 샘플을 가져온 후 다음 거래가 반환되거나 다음 가격 이동과 같은 대상 변수 y가 포함됩니다. 훈련 과정에서, 알고리즘은 예측 자 x 1 .. x n으로부터 표적 y를 예측하는 것을 학습합니다. 배운 & # 821; 메모리 & # 8217; 알고리즘과 관련된 모델이라는 이름의 데이터 구조에 저장됩니다. 이러한 모델은 교육 과정에서 생성 된 C 코드의 예측 규칙이있는 함수가 될 수 있습니다. 또는 신경망의 연결 가중치 집합 일 수 있습니다.


예측 인자는 표적 y를 정확하게 예측하기에 충분한 정보를 가지고 있어야한다. 그들은 또한 종종 두 가지 형식적인 요구 사항을 이행해야합니다. 첫째, 모든 예측 변수 값은 -1 .. +1 (대부분의 R 알고리즘) 또는 -100 .. +100 (Zorro 또는 TSSB 알고리즘)과 같은 범위에 있어야합니다. 따라서 기계에 보내기 전에 어떤 방식으로 그들을 정상화해야합니다. 둘째, 표본은 균형을 유지해야한다. 즉 표적 변수의 모든 값에 균등하게 분포되어야한다. 따라서 샘플을 잃는 것만큼이나 승리해야합니다. 이 두 가지 요구 사항을 준수하지 않으면 기계 학습 알고리즘에서 왜 나쁜 결과를 얻는 지 궁금 할 것입니다.


회귀 알고리즘은 다음 가격 이동의 크기 및 부호와 같은 숫자 값을 예측합니다. 분류 알고리즘은 예를 들어 승패를 앞두고 질적 샘플 클래스를 예측합니다. 신경망, 의사 결정 트리 또는 지원 벡터 시스템과 같은 일부 알고리즘은 두 가지 모드에서 모두 실행될 수 있습니다.


몇 가지 알고리즘은 어떤 타겟 y도 필요없이 샘플을 클래스로 나눠주는 것을 배웁니다. 타겟을 사용하는 감독 학습과는 대조적으로 무 감독 학습입니다. 그 중 어딘가에는 보강 학습이 있습니다. 여기서 시스템은 주어진 기능을 사용하여 시뮬레이션을 실행하고 결과를 교육 목표로 사용하여 교육을받습니다. 알파 조 (AlphaGero)의 후계자 인 알파 제로 (AlphaZero)는 수백만 개의 고 (Go) 게임을 자체적으로 플레이함으로써 강화 학습을 사용했습니다. 금융 분야에서는 감독되지 않거나 강화 학습을하는 경우가 거의 없습니다. 99 %의 기계 학습 전략이 감독 학습을 사용합니다.


재무 예측 변수에 대해 우리가 사용하는 신호가 무엇이든 관계없이 대부분 소음과 정보가 거의 없을 것이며 그 위에 고정되어있을 것입니다. 따라서 재무 예측은 기계 학습에서 가장 어려운 작업 중 하나입니다. 보다 복잡한 알고리즘이 반드시 더 나은 결과를 얻는 것은 아닙니다. 예측 변수의 선택은 성공에 중요합니다. 많은 예측 요소를 사용하는 것은 좋은 생각이 아닙니다. 이는 단순히 표본 연산의 초과 적용과 실패를 유발하기 때문입니다. 따라서 데이터 마이닝 전략은 종종 많은 수의 풀에서 소수의 예측자를 결정하는 사전 선택 알고리즘을 적용합니다. 사전 선택은 예측 자간의 상관 관계, 중요성, 정보 내용 또는 단순히 테스트 세트를 사용한 예측 성공에 기초 할 수 있습니다. 기능 선택을 사용한 실제 실험은 Robot Wealth 블로그의 최근 기사에서 찾을 수 있습니다.


다음은 금융에서 사용되는 가장 널리 사용되는 데이터 마이닝 방법 목록입니다.


1. 표시기 스프.


고객을 위해 프로그래밍하는 대부분의 거래 시스템은 재무 모델을 기반으로하지 않습니다. 고객은 특정 기술 지표의 무역 신호를 원했고 다른 기술적 지표와 함께 기술적 인 지표와 함께 필터링했습니다. 이 지표가 어떻게 수익성 높은 전략이 될 수 있는지 묻는 질문에 그는 보통 "나를 믿어 라. 수동으로 거래하고 있습니다. & # 8221;


그것은 정말로했다. 가끔은. 대부분의 시스템이 WFA 테스트를 통과하지 못했지만 일부는 단순한 백 테스트가 아니었지만 놀랍게도 많은 수의 테스트가 통과되었습니다. 그리고 그것들은 또한 종종 실제 거래에서 수익성이있었습니다. 클라이언트는 특정 자산에 대한 실시간 거래에서 작동하는 조합을 발견 할 때까지 기술 지표를 체계적으로 실험했습니다. 시행 착오적 인 기술적 분석 방법은 컴퓨터가 아닌 사람이 실행하는 고전적인 데이터 마이닝 방식입니다. 나는이 방법을 정말로 추천 할 수 없다. & # 8211; 돈을 말하는 것이 아니라 운이 많이 바뀌는 것은 아마 관련되어 있습니다 & # 8211; 하지만 수익성있는 시스템으로 연결되는 경우가 있음을 간증 할 수 있습니다.


2. 양초 무늬.


오래 전에 오래 전에 사용했던 그 일본 촛불 모양과 혼동하지 마십시오. 현대의 동등한 가격 액션 거래입니다. 당신은 아직도 열린, 높고 낮은, 그리고 닫는 양초를보고 있습니다. 당신은 여전히 ​​가격 방향을 예측하는 패턴을 찾기를 희망합니다. 하지만 이제는 이러한 패턴을 수집하는 데 필요한 데이터 마이닝 현대 가격 곡선을 얻으실 수 있습니다. 그 목적을위한 소프트웨어 패키지가 있습니다. 사용자 정의 기준에 따라 수익성이있는 패턴을 검색하고이를 사용하여 특정 패턴 탐지 기능을 구축합니다. Zorro의 패턴 분석기에서 볼 수 있습니다.


이 C 함수는 신호가 패턴 중 하나와 일치하면 1을 반환하고 그렇지 않으면 0을 반환합니다. 긴 코드에서 패턴을 감지하는 가장 빠른 방법이 아닌 것을 볼 수 있습니다. 감지 기능을 내보낼 필요가 없을 때 Zorro가 사용하는 더 나은 방법은 신호를 크기로 정렬하고 정렬 순서를 확인하는 것입니다. 그러한 시스템의 예가 여기에 있습니다.


가격 액션 거래는 실제로 효과가 있습니까? 지표 스프와 마찬가지로 합리적인 재무 모델을 기반으로하지도 않습니다. 가격 변동의 연속이 시장 참여자로 하여금 특정 방식으로 반응하도록 유도함으로써 일시적인 예측 패턴을 수립하는 것을 상상할 수 있습니다. 그러나 몇 개의 인접한 양초의 순서 만 볼 때 패턴의 수는 상당히 제한됩니다. 다음 단계는 인접하지 않지만 더 긴 시간 내에 임의로 선택된 양초를 비교하는 것입니다. 이렇게하면 거의 무제한의 패턴을 얻을 수 있습니다. & # 8211; 그러나 결국 합리적인 영역을 떠나는 대가로 몇 주 전에 촛불 가격 패턴이 어떻게 예측 될지 상상하기 어렵습니다.


아직도 많은 노력이 진행 중입니다. 동료 블로거 인 다니엘 페르난데스 (Daniel Fernandez)는 데이터 마이닝 촛불 패턴을 전문으로하는 구독 웹 사이트 (Asirikuy)를 운영합니다. 그는 가장 작은 세부 사항에 이르기까지 패턴 거래를 세련 시켰으며, 누구든지이 이익을 이룰 수 있다면 그 사람이 될 것입니다. 그러나 그의 가입자들에게 & # 8217; 실망, 그의 패턴을 라이브 거래 (QuriQuant) 그의 훌륭한 backtests보다 매우 다른 결과를 생산. 수익성있는 가격 행동 시스템이 실제로 존재한다면 분명히 아무도 아직 그것을 발견하지 못했다.


3. 선형 회귀.


많은 복잡한 기계 학습 알고리즘의 간단한 기초 : 예측 변수 x 1 .. x n의 선형 조합으로 목표 변수 y를 예측합니다.


계수 a n은 모델입니다. 트레이닝 샘플의 실제 y 값과 위의 수식에서 예측 한 y의 차이 제곱의 합을 최소화하기 위해 계산됩니다.


정규 분산 샘플의 경우 일부 행렬 산술을 사용하면 최소화가 가능하므로 반복 할 필요가 없습니다. n = 1 인 경우 & # 8211; 단 하나의 예측 변수 x & # 8211; 회귀 식은로 축소됩니다.


이는 n> 1 인 다 변수 선형 회귀와 반대로 단순 선형 회귀이다. 1 . 단순 선형 회귀는 대부분의 거래 플랫폼에서 사용할 수 있습니다 (f. i. TA-Lib에있는 LinReg 표시기가 있습니다. y = price와 x = time을 사용하면 종종 이동 평균에 대한 대안으로 사용됩니다. 다 변수 선형 회귀는 표준 설치와 함께 제공되는 lm (..) 함수를 통해 R 플랫폼에서 사용할 수 있습니다. 변형은 다항 회귀입니다. 단순 회귀와 마찬가지로 하나의 예측 변수 x를 사용하지만 그 정사각형 및 고차도 사용하므로 x n == x n :


n = 2 또는 n = 3 인 경우 다항 회귀는 종종 마지막 막대의 매끄러운 가격에서 다음 평균 가격을 예측하는 데 사용됩니다. MatLab, R, Zorro 및 기타 여러 플랫폼의 다기능 기능을 다항식 회귀에 사용할 수 있습니다.


4. 퍼셉트론.


단 하나의 뉴런이있는 신경망이라고도합니다. 실제로 퍼셉트론은 위와 같은 회귀 함수이지만 이진 결과는 로지스틱 회귀라고 불립니다. 그것은 회귀는 아니지만 분류 알고리즘입니다. Zorro의 조언 (PERCEPTRON, & # 8230;) 함수는 예측 결과가 임계 값 이상인지 여부에 따라 100 또는 -100을 반환하는 C 코드를 생성합니다.


sig 배열은 회귀 공식의 피쳐 x n과 동일하고 숫자 인자는 계수 a n이라는 것을 볼 수 있습니다.


5. Nural 네트워크.


선형 또는 로지스틱 회귀는 선형 문제 만 해결할 수 있습니다. 많은 사람들이이 카테고리에 속하지 않습니다. & # 8211; 유명한 예가 간단한 XOR 함수의 출력을 예측하는 것입니다. 그리고 가격이나 무역 수익을 예측할 가능성이 가장 큽니다. 인공 신경망 (ANN)은 비선형 문제를 해결할 수 있습니다. 그것은 일련의 레이어들로 함께 연결된 퍼셉트론들의 무리입니다. 모든 퍼셉트론은 그물의 뉴런입니다. 그 출력은 다음과 같은 모든 뉴런의 입력으로갑니다 :


퍼셉트론과 마찬가지로, 신경 회로망은 표본 예측과 표본 표적 간의 오차를 최소화하는 계수를 결정하여 학습합니다. 그러나 이것은 근사화 과정을 필요로합니다. 보통 출력에서 ​​입력으로의 오류를 백 프로 퍼 게이트하여 가중치를 최적화합니다. 이 프로세스는 두 가지 제한 사항을 부과합니다. 첫째, 뉴런 출력은 이제 단순한 퍼셉트론 임계 값 대신 지속적으로 차별화 가능한 기능이되어야합니다. 둘째, 네트워크가 너무 깊어서는 안됩니다. & # 8211; 너무 많은 & # 8216; 숨겨진 레이어가 없어야합니다. & # 8217; 입력과 출력 사이의 뉴런 이 두 번째 제한은 표준 신경 네트워크가 해결할 수있는 문제의 복잡성을 제한합니다.


거래를 예측하기 위해 신경망을 사용할 때 주위를 둘러 볼 수있는 많은 매개 변수가 있으며 조심하지 않으면 선택 편향이 많이 발생합니다.


숨겨진 레이어의 수 숨겨진 레이어 당 뉴런의 수 백프로핑 사이클의 수, 명명 된 에포크 학습 속도, 에포크의 스텝 폭 모멘텀, 가중치 적용을위한 관성 팩터 활성화 기능.


활성화 함수는 퍼셉트론 임계 값을 에뮬레이션합니다. 역 전파 (backpropagation)를 위해서 당신은 계속해서 차분 할 수있는 함수가 필요합니다. 이 함수는 부드러운 & # 8217; 특정 x 값에서 단계. 일반적으로 시그 모이 드, tanh 또는 softmax 기능이 사용됩니다. 때로는 모든 입력의 가중 합을 반환하는 선형 함수이기도합니다. 이 경우 네트워크를 회귀 분석에 사용하여 이진 결과 대신 숫자 값을 예측할 수 있습니다.


신경망은 표준 R 설치 (nnet, 단일 숨겨진 계층 네트워크) 및 많은 패키지 (예 : RSNNS 및 FCNN4R)에서 사용할 수 있습니다.


6. 깊은 학습.


딥 학습 방법은 많은 숨은 레이어와 수천 개의 뉴런이있는 신경망을 사용하며, 이는 전통적인 백 프로 퍼 게이션에 의해 효과적으로 훈련 될 수 없습니다. 지난 몇 년 동안 이러한 거대한 네트워크를 교육하기 위해 몇 가지 방법이 널리 사용되었습니다. 그들은 일반적으로 더 효과적인 학습 과정을 달성하기 위해 숨겨진 뉴런 레이어를 미리 훈련시킵니다. Restricted Boltzmann Machine (RBM)은 숨겨진 뉴런 간의 연결이없는 특별한 네트워크 구조의 감독되지 않은 분류 알고리즘입니다. SAE (Sparse Autoencoder)는 기존의 네트워크 구조를 사용하지만 가능하면 활성 연결을 거의 사용하지 않고 계층 출력에서 ​​입력 신호를 재생하여 숨은 계층을 영리하게 미리 예고합니다. 이러한 방법을 사용하면 매우 복잡한 학습 과제를 처리하기 위해 매우 복잡한 네트워크를 사용할 수 있습니다. 세계 최고의 플레이어 인 'Go'를이기는 것.


깊은 학습 네트워크는 deepnet 및 darch R 패키지에서 제공됩니다. Deepnet은 제한된 Boltzmann 기계 인 Autoencoder를 제공합니다. 아직 Darch를 실험하지는 않았지만, Zorro의 neural () 함수를 통해 무역 신호에 3 개의 숨겨진 레이어가있는 Deepnet 자동 코드를 사용하는 예제 R 스크립트는 다음과 같습니다.


7. 지원 벡터 머신.


신경 회로망과 마찬가지로 SVM (Support Vector Machine)도 선형 회귀의 또 다른 확장입니다. 회귀 식을 다시 보면,


우리는 n 차원 피처 공간의 좌표로 피처 x n을 해석 할 수있다. 목표 변수 y를 고정 값으로 설정하면이 공간에 평면이 두 개 이상 (사실 n-1) 크기이므로 초평면이라고하는 평면이 결정됩니다. 초평면은 y & gt; y & lt; 0. n 계수는 평면과 가장 가까운 샘플 간의 거리를 계산할 수 있습니다. & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & quot; 지원 벡터 & quot; 따라서 비행기 이름의 & # 8211; 최대 값입니다. 이 방법으로 우승과 분실을 최적으로 분리 한 바이너리 분류기를 사용할 수 있습니다.


문제 : 일반적으로 샘플은 선형으로 분리되지 않습니다. & # 8211; 그들은 특징 공간에서 불규칙하게 흩어져있다. 승자와 패자 사이에 평평한 평면을 압착 할 수 없습니다. 가능하다면 그 비행기를 계산하는 더 간단한 방법이 있습니다, f. i. 선형 판별 분석. 그러나 일반적인 경우 SVM 트릭이 필요합니다 : 특징 공간에 더 많은 차원 추가하기. 이를 위해 SVM 알고리즘은 두 개의 기존 예측 변수를 새로운 기능과 결합한 커널 기능으로 더 많은 기능을 생성합니다. 이것은 단순 회귀에서 다항식 회귀에 이르기까지 위의 단계와 유사합니다. 단 하나의 예측자를 n 번째 지수로 취하여 더 많은 특징이 추가됩니다. 더 많은 치수를 추가할수록 편평한 초평면으로 샘플을 분리하는 것이 더 쉬워집니다. 이 평면은 원래의 n 차원 공간으로 다시 변환되어 그 과정에서 구겨지고 구겨집니다. 커널 함수를 영리하게 선택하면 실제로 변환을 계산하지 않고도 프로세스를 수행 할 수 있습니다.


신경망과 마찬가지로 SVM은 분류뿐만 아니라 회귀에도 사용할 수 있습니다. 그들은 또한 예측 프로세스를 최적화하고 가능하게 초과 적용하기위한 몇 가지 매개 변수를 제공합니다.


커널 기능. 일반적으로 RBF 커널 (방사형 기본 함수, 대칭 커널)을 사용하지만 시그 모이 드, 다항식 및 선형과 같은 다른 커널을 선택할 수도 있습니다. 감마, RBF 커널의 너비 비용 매개 변수 C, 페널티 & # 8217; 훈련 샘플에서의 잘못된 분류.


자주 사용되는 SVM은 libsvm 라이브러리입니다. 또한 e1071 패키지의 R로도 제공됩니다. 이 시리즈의 마지막이자 마지막 부분에서는이 SVM을 사용하여 거래 전략을 설명하려고합니다.


8. K - 가장 가까운 이웃.


무거운 ANN 및 SVM과 비교하면 고유 한 속성을 가진 멋진 간단한 알고리즘입니다. 교육이 필요하지 않습니다. 따라서 샘플이 모델입니다. 더 많은 샘플을 추가함으로써 영구적으로 학습하는 거래 시스템에이 알고리즘을 사용할 수 있습니다. 가장 가까운 이웃 알고리즘은 현재 특징 값에서 가장 가까운 k 개의 샘플까지 특징 공간에서의 거리를 계산합니다. 2 개의 피쳐 세트 (x1 .. xn)와 (y1 .. yn) 사이의 n 차원 공간에서의 거리는 2 차원 에서처럼 계산됩니다.


이 알고리즘은 가장 가까운 샘플의 k 개의 목표 변수의 평균으로부터 목표를 예측하고, 그 역 거리로 가중치를 부여합니다. 회귀뿐만 아니라 분류에도 사용할 수 있습니다. ABT (adaptive binary tree)와 같은 컴퓨터 그래픽에서 빌린 소프트웨어 트릭은 가장 가까운 이웃 검색을 매우 빠르게 만들 수 있습니다. 컴퓨터 게임 프로그래머로서의 나의 과거 생활에서, 우리는 자기 학습 적 정보와 같은 작업을 위해 게임에서 그러한 방법을 사용했습니다. 가까운 이웃 예측을 위해 R에서 knn 함수를 호출 할 수 있습니다. 또는 그 목적을 위해 C에 간단한 함수를 작성하십시오.


이것은 감독되지 않은 분류에 대한 근사 알고리즘입니다. 그것은 k - 가장 가까운 이웃에게 그것의 이름뿐만 아니라, 약간의 유사성을 가지고있다. 샘플을 분류하기 위해 알고리즘은 우선 k 개의 무작위 포인트를 특징 공간에 배치합니다. 그런 다음 가장 가까운 거리에있는 모든 샘플을 해당 포인트 중 하나에 지정합니다. 그런 다음 포인트는 이러한 가장 가까운 샘플의 평균으로 이동합니다. 일부 샘플은 이제 다른 지점에 가까워 지므로 새로운 샘플 할당이 생성됩니다. 포인트를 이동하여 할당이 더 이상 변하지 않을 때까지, 즉 각 포인트가 가장 가까운 샘플의 평균에 정확하게 위치 할 때까지 프로세스가 반복됩니다. 우리는 이제 k 점 중 하나의 근처에 각각 k 종류의 표본을 가지고 있습니다.


이 간단한 알고리즘은 놀랄만큼 좋은 결과를 만들어 낼 수 있습니다. R에서는 kmeans 함수가 트릭을 수행합니다. 양초 패턴을 분류하기위한 k-means 알고리즘의 예는 다음에서 찾을 수 있습니다 : 재미 있고 이익을위한 감독되지 않은 촛대 분류.


10. Naive Bayes.


이 알고리즘은 Bayes & # 8217; 위에서 언급 한 양초 패턴과 같은 숫자가 아닌 기능 (예 : 이벤트)의 샘플을 분류하기위한 정리입니다. 이벤트 X (예 : 이전 막대 열기가 현재 막대 열기 아래 있음)가 모든 우승 샘플의 80 %에 나타납니다. 샘플 X가 이벤트 X를 포함하고있을 때 샘플이 승리 할 확률은 얼마입니까? 생각할 수 있듯이 0.8이 아닙니다. 확률은 Bayes & # 8217; 정리:


P (Y | X)는 이벤트 X (이 예에서는 Open (1) & lt; Open (0))를 포함하는 모든 샘플에서 이벤트 Y (f. i. 공식에 따르면, 모든 샘플에서 X가 발생할 확률 (여기서는 0.8), 모든 샘플에서 Y의 확률을 곱한 값 (균형 샘플의 위의 조언을 따랐을 때 약 0.5)과 모든 표본에서 X의 확률.


우리가 순진하고 모든 사건 X가 서로 독립적이라고 가정하면 모든 사건 X에 대해 확률 P (X | winning)를 단순히 곱함으로써 표본이 승리하는 전체 확률을 계산할 수 있습니다. 이렇게하면 다음 공식으로 끝납니다.


스케일링 인자 s. 수식이 작동하려면 기능이 가능한 한 독립적 인 방식으로 선택되어야하며, 이는 Naive Bayes를 거래에 사용하는 데 장애가됩니다. 예를 들어, 2 개의 이벤트 Close (1) & lt; 닫기 (0) 및 열기 (1) & lt; Open (0)은 서로 독립적이지 않을 가능성이 큽니다. 수치 예측 인자는 수를 별도의 범위로 나누어 이벤트로 변환 할 수 있습니다.


Naive Bayes 알고리즘은 유비쿼터스 e1071 R 패키지로 제공됩니다.


11. 결정 및 회귀 나무.


이 나무들은 나무의 가지와 같은 구조에서 일련의 예 / 아니오 결정을 기반으로 결과 또는 숫자 값을 예측합니다. 모든 결정은 사건의 존재 여부 (비 수치 적 특성의 경우) 또는 특징 값과 고정 된 임계 값의 비교 중 하나입니다. Zorro의 트리 빌더가 생성하는 일반적인 트리 함수는 다음과 같습니다.


그런 나무는 샘플 세트에서 어떻게 만들어 지나요? 몇 가지 방법이 있습니다. Zorro는 Scalping 기사에서이 블로그에 이미 등장한 Shannon i nformation 엔트로피를 사용합니다. 처음에는 기능 중 하나를 확인하고 x 1이라고 말합니다. 평면 공식 x 1 = t를 가진 초평면을 형상 공간에 배치합니다. 이 초평면은 x1 & gt; 샘플로부터 x1 & lt; t. 분할 임계치 (t)는 정보 이득 (& gt; 전체 공간의 정보 엔트로피의 차이, 두 개의 분할 된 부분 공간의 정보 엔트로피의 합; 최대 값입니다. 이것은 부분 공간의 표본이 전체 표본의 표본보다 더 유사 할 경우입니다.


이 과정은 다음 피쳐 x 2와 두 개의 부분 공간을 분할하는 두 개의 초평면으로 반복됩니다. 각 분할은 특성과 임계 값의 비교와 같습니다. 반복되는 분할로 인해 우리는 수천 개의 임계 비교를 가진 거대한 나무를 곧 얻습니다. 그런 다음 트리를 잘라내어 실질적인 정보를 얻지 못하는 모든 결정을 제거하여 프로세스를 거꾸로 실행합니다. 마지막으로 우리는 위의 코드 에서처럼 상대적으로 작은 트리로 끝납니다.


의사 결정 트리에는 다양한 응용 프로그램이 있습니다. 그들은 신경망이나 벡터 머신을 능가하는 우수한 예측을 낼 수 있습니다. But they are not a one-fits-all solution, since their splitting planes are always parallel to the axes of the feature space. This somewhat limits their predictions. They can be used not only for classification, but also for regression, for instance by returning the percentage of samples contributing to a certain branch of the tree. Zorro’s tree is a regression tree. The best known classification tree algorithm is C5.0 , available in the C50 package for R.


For improving the prediction even further or overcoming the parallel-axis-limitation, an ensemble of trees can be used, called a random forest . The prediction is then generated by averaging or voting the predictions from the single trees. Random forests are available in R packages randomForest , ranger and Rborist .


결론.


There are many different data mining and machine learning methods at your disposal. The critical question: what is better, a model-based or a machine learning strategy? There is no doubt that machine learning has a lot of advantages. You don’t need to care about market microstructure, economy, trader psychology, or similar soft stuff. You can concentrate on pure mathematics. Machine learning is a much more elegant, more attractive way to generate trade systems. It has all advantages on its side but one. Despite all the enthusiastic threads on trader forums, it tends to mysteriously fail in live trading.


Every second week a new paper about trading with machine learning methods is published (a few can be found below). Please take all those publications with a grain of salt. According to some papers, phantastic win rates in the range of 70%, 80%, or even 85% have been achieved. Although win rate is not the only relevant criterion – you can lose even with a high win rate – 85% accuracy in predicting trades is normally equivalent to a profit factor above 5. With such a system the involved scientists should be billionaires meanwhile. Unfortunately I never managed to reproduce those win rates with the described method, and didn’t even come close. So maybe a lot of selection bias went into the results. Or maybe I’m just too stupid.


Compared with model based strategies, I’ve seen not many successful machine learning systems so far. And from what one hears about the algorithmic methods by successful hedge funds, machine learning seems still rarely to be used. But maybe this will change in the future with the availability of more processing power and the upcoming of new algorithms for deep learning.


Classification using deep neural networks: Dixon. et. al.2016 Predicting price direction using ANN & SVM: Kara. et. al.2011 Empirical comparison of learning algorithms: Caruana. et. al.2006 Mining stock market tendency using GA & SVM: Yu. Wang. Lai.2005.


The next part of this series will deal with the practical development of a machine learning strategy.


30 thoughts on “Build Better Strategies! Part 4: Machine Learning”


좋은 게시물. There is a lot of potential in these approach towards the market.


Btw are you using the code editor which comes with zorro? how is it possible to get such a colour configuration?


The colorful script is produced by WordPress. You can’t change the colors in the Zorro editor, but you can replace it with other editors that support individual colors, for instance Notepad++.


Is it then possible that notepad detects the zorro variables in the scripts? I mean that BarPeriod is remarked as it is with the zorro editor?


Theoretically yes, but for this you had to configure the syntax highlighting of Notepad++, and enter all variables in the list. As far as I know Notepad++ can also not be configured to display the function description in a window, as the Zorro editor does. There’s no perfect tool…


Concur with the final paragraph. I have tried many machine learning techniques after reading various ‘peer reviewed’ papers. But reproducing their results remains elusive. When I live test with ML I can’t seem to outperform random entry.


ML fails in live? Maybe the training of the ML has to be done with price data that include as well historical spread, roll, tick and so on?


I think reason #1 for live failure is data mining bias, caused by biased selection of inputs and parameters to the algo.


Thanks to the author for the great series of articles.


However, it should be noted that we don’t need to narrow our view with predicting only the next price move. It may happen that the next move goes against our trade in 70% of cases but it still worth making a trade. This happens when the price finally does go to the right direction but before that it may make some steps against us. If we delay the trade by one price step we will not enter the mentioned 30% of trades but for that we will increase the result of the remained 70% by one price step. So the criteria is which value is higher: N*average_result or 0.7*N*(avergae_result + price_step).


좋은 게시물. If you just want to play around with some machine learning, I implemented a very simple ML tool in python and added a GUI. It’s implemented to predict time series.


Thanks JCL I found very interesting your article. I would like to ask you, from your expertise in trading, where can we download reliable historical forex data? I consider it very important due to the fact that Forex market is decentralized.


미리 감사드립니다!


There is no really reliable Forex data, since every Forex broker creates their own data. They all differ slightly dependent on which liquidity providers they use. FXCM has relatively good M1 and tick data with few gaps. You can download it with Zorro.


Thanks for writing such a great article series JCL… a thoroughly enjoyable read!


I have to say though that I don’t view model-based and machine learning strategies as being mutually exclusive; I have had some OOS success by using a combination of the elements you describe.


To be more exact, I begin the system generation process by developing a ‘traditional’ mathematical model, but then use a set of online machine learning algorithms to predict the next terms of the various different time series (not the price itself) that are used within the model. The actual trading rules are then derived from the interactions between these time series. So in essence I am not just blindly throwing recent market data into an ML model in an effort to predict price action direction, but instead develop a framework based upon sound investment principles in order to point the models in the right direction. I then data mine the parameters and measure the level of data-mining bias as you’ve described also.


It’s worth mentioning however that I’ve never had much success with Forex.


Anyway, best of luck with your trading and keep up the great articles!


Thanks for posting this great mini series JCL.


I recently studied a few latest papers about ML trading, deep learning especially. Yet I found that most of them valuated the results without risk-adjusted index, i. e., they usually used ROC curve, PNL to support their experiment instead of Sharpe Ratio, for example.


Also, they seldom mentioned about the trading frequency in their experiment results, making it hard to valuate the potential profitability of those methods. 왜 그런가요? Do you have any good suggestions to deal with those issues?


ML papers normally aim for high accuracy. Equity curve variance is of no interest. This is sort of justified because the ML prediction quality determines accuracy, not variance.


Of course, if you want to really trade such a system, variance and drawdown are important factors. A system with lower accuracy and worse prediction can in fact be preferable when it’s less dependent on market condictions.


“In fact the most popular – and surprisingly profitable – data mining method works without any fancy neural networks or support vector machines.”


Would you please name those most popular & surprisingly profitable ones. So I could directly use them.


I was referring to the Indicator Soup strategies. For obvious reasons I can’t disclose details of such a strategy, and have never developed such systems myself. We’re merely coding them. But I can tell that coming up with a profitable Indicator Soup requires a lot of work and time.


Well, i am just starting a project which use simple EMAs to predict price, it just select the correct EMAs based on past performance and algorithm selection that make some rustic degree of intelligence.


Jonathan. orregogmail offers services as MT4 EA programmer.


Thanks for the good writeup. It in reality used to be a leisure account it.


Look complicated to more delivered agreeable from you!


By the way, how could we be in contact?


There are following issues with ML and with trading systems in general which are based on historical data analysis:


1) Historical data doesn’t encode information about future price movements.


Future price movement is independent and not related to the price history. There is absolutely no reliable pattern which can be used to systematically extract profits from the market. Applying ML methods in this domain is simply pointless and doomed to failure and is not going to work if you search for a profitable system. Of course you can curve fit any past period and come up with a profitable system for it.


The only thing which determines price movement is demand and supply and these are often the result of external factors which cannot be predicted. For example: a war breaks out somewhere or other major disaster strikes or someone just needs to buy a large amount of a foreign currency for some business/investment purpose. These sort of events will cause significant shifts in the demand supply structure of the FX market . As a consequence, prices begin to move but nobody really cares about price history just about the execution of the incoming orders. An automated trading system can only be profitable if it monitors a significant portion of the market and takes the supply and demand into account for making a trading decision. But this is not the case with any of the systems being discussed here.


2) Race to the bottom.


Even if (1) wouldn’t be true and there would be valuable information encoded in historical price data, you would still face following problem: there are thousands of gold diggers out there, all of them using similar methods and even the same tools to search for profitable systems and analyze the same historical price data. As a result, many of them will discover the same or very similar “profitable” trading systems and when they begin actually trading those systems, they will become less and less profitable due to the nature of the market.


The only sure winners in this scenario will be the technology and tool vendors.


I will be still keeping an eye on your posts as I like your approach and the scientific vigor you apply. Your blog is the best of its kind – keep the good work!


One hint: there are profitable automated systems, but they are not based on historical price data but on proprietary knowledge about the market structure and operations of the major institutions which control these markets. Let’s say there are many inefficiencies in the current system but you absolutely have no chance to find the information about those by analyzing historical price data. Instead you have to know when and how the institutions will execute market moving orders and front run them.


Thanks for the extensive comment. I often hear these arguments and they sound indeed intuitive, only problem is that they are easily proven wrong. The scientific way is experiment, not intuition. Simple tests show that past and future prices are often correlated – otherwise every second experiment on this blog had a very different outcome. Many successful funds, for instance Jim Simon’s Renaissance fund, are mainly based on algorithmic prediction.


One more thing: in my comment I have been implicitly referring to the buy side (hedge funds, traders etc) not to the sell side (market makers, banks). The second one has always the edge because they sell at the ask and buy at the bid, pocketing the spread as an additional profit to any strategy they might be running. Regarding Jim Simon’s Renaissance: I am not so sure if they have not transitioned over the time to the sell side in order to stay profitable. There is absolutely no information available about the nature of their business besides the vague statement that they are using solely quantitative algorithmic trading models…


Thanks for the informative post!


Regarding the use of some of these algorithms, a common complaint which is cited is that financial data is non-stationary…Do you find this to be a problem? Couldn’t one just use returns data instead which is (I think) stationary?


Yes, this is a problem for sure. If financial data were stationary, we’d all be rich. I’m afraid we have to live with what it is. Returns are not any more stationary than other financial data.


Hello sir, I developed some set of rules for my trading which identifies supply demand zones than volume and all other criteria. Can you help me to make it into automated system ?? If i am gonna do that myself then it can take too much time. Please contact me at svadukiagmail if you are interested.


Sure, please contact my employer at infoopgroup. de. They’ll help.


I have noticed you don’t monetize your page, don’t waste your traffic,


you can earn extra bucks every month because you’ve got high quality content.


If you want to know how to make extra $$$, search for: Mrdalekjd methods for $$$


Technical analysis has always been rejected and looked down upon by quants, academics, or anyone who has been trained by traditional finance theories. I have worked for proprietary trading desk of a first tier bank for a good part of my career, and surrounded by those ivy-league elites with background in finance, math, or financial engineering. I must admit none of those guys knew how to trade directions. They were good at market making, product structures, index arb, but almost none can making money trading directions. 왜? Because none of these guys believed in technical analysis. Then again, if you are already making your millions why bother taking the risk of trading direction with your own money. For me luckily my years of training in technical analysis allowed me to really retire after laying off from the great recession. I look only at EMA, slow stochastics, and MACD; and I have made money every year since started in 2009. Technical analysis works, you just have to know how to use it!!


Currency prediction based on a predictive algorithm.


왜 무역 통화인가?


Currencies Prediction: 10.88% gain in 3 months.


Are People Regaining Faith in the Dollar?


EUR/USD Forecast: 0.85% drop in 3 months.


I Know First’s unique algorithm predicts the movements of currency pairs by analyzing past data and identifying current trends. Below are the most recent pairs of past forecasts and the actual forecast results.


Forex Forecast Based on Machine Learning: 60.61% Hit Ratio in 3 Days.


3 day Currency Forecast from December 4th, 2017 to December 7th, 2017.


Best Currency Based on Genetic Algorithms: 68.57% Hit Ratio in 7 Days.


7 day Currency Forecast from November 24th, 2017 to December 1st, 2017.


Best Currencies Based on Genetic Algorithms: 66.67% Hit Ratio in 3 Days.


3 day Currency Forecast from November 24th, 2017 to November 27th, 2017.


Best Currencies Based on Algo Trading: 74.07% Hit Ratio in 1 Month.


1 month Currency Forecast from October 17th, 2017 to November 17th, 2017.


Currency Forecast Based on AI: 77.78% Hit Ratio in 1 Month.


1 month Currency Forecast from October 17th, 2017 to November 17th, 2017.


기계적인 Forex.


기계 거래 전략을 사용하여 외환 시장에서 거래합니다.


Machine Learning in Forex Trading: Why many academics are doing it all wrong.


Building machine learning strategiesВ that can obtain decent results under live market conditions has always been an important challenge in algorithmic trading. В Despite the great amount of interest and the incredible potential rewards, there are still no academic publications that are able to show good machine learning models that can successfully tackle the trading problem in the real market (to the best of my knowledge, post a comment if you have one and I’ll be more than happy to read it). Although many papers published do seem to show promising results, it is often the case that these papers fall into a variety of different statistical bias problems that make the real market success of their machine learning strategies highly improbable. On today’s post I am going to talk about the problems that I see in academic research related with machine learning in Forex and how I believe this research could be improved to yield much more useful information for both the academic and trading communities.


Most pitfalls in machine learning strategy design when doing Forex trading are inevitably inherited from the world of deterministic learning problems. When building a machine learning algorithm for something like face recognition or letter recognition there is a well defined problem that does not change, which is generally tackled by building a machine learning model on a subset of the data (a training set) and then testing if the model was able to correctly solve the problem by using the reminder of the data (a testing set). This is why you have some famous and well established data-sets that can be used to establish the quality of newly developed machine learning techniques. The key point here however, is that the problems initially tackled by machine learning were mostly deterministic and time independent.


When moving into trading, applying this same philosophy yields manyВ problems related with both the partially non-deterministic character of the market and its time dependence. The mere act of attempting to select training and testing sets introduces a significant amount of bias (a data selection bias) that creates a problem. If the selection is repeated to improve results in the testing set – which you must assume happens in at least some cases – then the problem also adds a great amount of data-mining bias. The whole issue of doing a single training/validation exercise also generates a problem pertaining to how this algorithm is to be applied when live trading. By definition the live trading will be different since the selection of training/testing sets needs to be reapplied to different data (as now the testing set is truly unknown data). The bias inherent in the initial in-sample/out-of-sample period selection and the lack of any tested rules for trading under unknown data makes such techniques to commonly fail in live trading. If an algorithm is trained with 2000-2012 data and was cross validated with 2012-2015 data there is no reason to believe that the same success will happen if trained in 2003-2015 data and then live traded from 2015 to 2017, the data sets are very different in nature.


측정 알고리즘 성공은 또한 여기에서 매우 관련된 문제입니다. Inevitably the machine learning algorithms used for trading should be measured in merit by their ability to generate positive returns but some literature measures the merit of new algorithmic techniques by attempting to benchmark their ability to getВ correct predictions. Correct predictions do not necessarily equal profitable trading as you can easily see when building binary classifiers. If you attempt to predict the next candle’s direction you can still make a loss if you are mostly right on small candles and wrong on larger candles. As a matter of fact most of this type of classifiers – most of those that don’t work – end up predicting directionality with an above 50% accuracy, yetВ not above the level needed to surpass commissions that would permit profitable binary options trading.


To build strategiesВ that are mostly rid of the above problems I have always advocated for a methodology in which the machine learning algorithm is retrained before the making of any training decision. By using a moving window for training and never making more than one decision without retraining the entire algorithm we can get rid of the selection bias that is inherent in choosing a single in-sample/out-of-sample set. In this manner the whole test is a series of training/validation exercises which end up ensuring that the machine learning algorithm works even under tremendously different training data sets. I also advocate for the measuring of actual backtesting performance to measure a machine learning algorithm’s merit and furthermore I would go as far as to say that no algorithm can be worth its salt without being proven under real out-of-sample conditions. Developing algorithms in this manner is much harder and I haven’t found a single academic paper that follows this type of approach (if I missed it feel free to post a link so that I can include a comment!).


This does not mean that this methodology is completely problem free however, it is still subject to the classical problems relevant to all strategy building exercises, including curve-fitting bias and data-mining bias. This is why it is also important to use a large amount of data (I use 25+ years to test systems, always retraining after each machine learning derived decision) and to perform adequate data-mining bias evaluation tests to determine the confidence with which we can say that the results do not come from random chance. My friend AlgoTraderJo – who also happens to be a member of my trading community – is currently growing a thread at ForexFactory following this same type of philosophy for machine learning development, as we work on some new machine learning algorithms for my trading community. You can refer to his thread or past posts on my blog for several examples of machine learning algorithms developed in this manner.


If you would like to learn more about our developments in machine learning and how you too can also develop your own machine learning strategies using the F4 frameworkВ please consider joining Asirikuy, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach towards automated trading.


5 Responses to “Machine Learning in Forex Trading: Why many academics are doing it all wrong”


Great article, the problems you highlight are certainly valid for system robustness!


A question I have, is it normal for say an EA to do exceedingly well in a certain pair and do terrible in all others?


Or, should a robust EA do well in at least several pairs, without any change in settings!


Thanks, for your great thoughts.


That question is interesting ;o). I believe that the question is better phrased as “can a system that survives on only one pair generate returns when live traded?” the answer is yes (both from theory and from my own experience). Having returns on only one pair does not mean that the system is “bad” it simply means that it exploits a historical inefficiency that is only present on one instrument. Provided you take care of bias sources (such as data-mining bias and curve-fitting bias) there is no reason why this will not work.


Now, if you have a system that works across many symbols then data-mining bias will be exponentially lower for an equal system that only works on one symbol and curve-fitting bias will also be lower due to the use of more data. So I would say that it’s better, but definitely not required.


But remember, measure your statistical biases!


I am so glad that you said it does not have to make a profit across all pairs! Also curve fitting, how does one know the limit of tweaking allowed before it becomes fitted?


Finally, I did a very simple test using the bog standard Moving Average EA on MT4, to see which pairs would react most widely to MAs. I backtested 52 pairs to see how many ‘Moving Period’between (1-20) would make a profit, regardless of drawdown. I wondered what you make of the results!


* 5 year test period.


* Drawdown not measured.


* 52 Pairs tested.


* Settings tested (Periods 1-20).


1 23 pairs, made no profit on any bar settings 1-20.


2 6 pairs, could only make profit on 1 setting.


3 14 pairs only, returned a profit on 5, or more different settings.


4 5 pairs only, returned a profit on 10, or more different settings.


1 BTCUSD 19 Settings out of 20, made a profit.


You need to make a distinction between curve-fitting bias and data-mining bias (or at least these two different types of bias, however you may want to call them). Curve-fitting bias is a bias created by finding an inefficiency across a set of data, it answers the question: is my system finding something general or something specific to the data I am using?. Data-mining bias answers the question: is my system finding a real historical inefficiency or are the results just because of my mining process (meaning coming from random chance)?


By increasing parameter spaces and degrees of freedom you are increasing data-mining bias (you are more likely to find a system just by chance, instead of a system that trades a real historical inefficiency). You can measure data-mining bias by using a test like White’s reality check. Doing this type of test is fundamental to reliable strategy design.


Read more about this distinction between biases here:


Also read this paper on the subject:


Before dwelling into the complexities of trading system design and finding strategies for trading I strongly advice getting a solid formation in statistics (coursera statistics courses are an excellent free start). Statistics will give you the power to analyse your own results and methodically address questions like these ;o)


[…] Machine Learning in Forex Trading: Why many academics are doing it all wrong [Mechanical Forex] Building machine learning strategies that can obtain decent results under live market conditions has always been an important challenge in algorithmic trading. Despite the great amount of interest and the incredible potential rewards, there are still no academic publications that are able to show good machine learning models that can successfully tackle the trading problem in the real m […]

Comments

Popular posts from this blog

Belajar membaca indikator 외환

Forex 이진

Forex 도서 2017