📜 ⬆️ ⬇️

Analysis of binary options charts or how I once again proved to myself that freebies do not exist



Recently, I stumbled upon an entertaining video from the category of "To quickly become rich you need only ...". The video begins with a pathetic recalculation of a solid wad of money and a demonstration of a decent bill. Next, the guy shows a strategy that is based on the phrase "Well, look at the chart, here it is clear."


However, I am a modest person, and therefore I decided before going after my Lard to first check this strategy mathematically and programmatically. Below you can see what came of it.


I will first describe the “Strategy” (I'm not sure that I can drop the link to the video here, but I will do it in the comments if necessary). The guy suggested that we switch the chart to the Japanese candles and then just put on the same course as the previous candle was closed. That is, if the last segment of 5 minutes was closed in a minus, then now we put on a minus. In the case of losing the next time double the bet.

Oh, how I like martingales with smart strategies . But let's get down to business.



Let's start with the decomposition of the task:


  1. You need to write a script that converts the graph into a string of the type OOGGO, where O is Orange, G is Green. That is, the fall and growth.
  2. Next, you need to simulate a strategy on this line and collect statistics.
  3. Analyze the results and make a conclusion.

Writing graphics analyzer


The graph on the site is an SVG element. Of course, we can analyze it right there, but first I would prefer to work in my own project. In the end, we would first be convinced of the effectiveness of the strategy, and only then write a robot, which will click our farm to farm our "wealth"


Comments immediately after the code.


function turnToString(img) {
	var canvas = document.createElement('canvas'); //(1)
	var ctx = canvas.getContext('2d');

	canvas.width = img.width;
	canvas.height = img.height;
	ctx.drawImage(img, 0, 0, img.width, img.height);

	img.remove();
	document.body.appendChild(canvas); 

	var result = [];
	var isLocked = false;
	var imgData = ctx.getImageData(0,0,canvas.width,canvas.height).data;

	for(var i = 0;i<canvas.width;i++) {
		var mainColor = "N";
		for(var j = 0;j<canvas.height;j++) { //(2)
			var colorIndexes = getColorIndexes(i,j,canvas.width);
			var redPartIndex= colorIndexes[0];
			var greenPartIndex= colorIndexes[1];

			if (imgData[redPartIndex] > 120) {
				mainColor = "O";
				break;
			}
			if (imgData[greenPartIndex] > 120) {
				mainColor = "G";
				break;
			}
		}

		if (isLocked == false && mainColor == "G") { //(3)
			result.push("G");
			isLocked = true;
		}
		if (isLocked == false && mainColor == "O") {
			result.push("O");
			isLocked = true;
		}
		if (mainColor == "N") {
			isLocked = false;
		}

		console.log("Yet another line")

	}
	return result.join("");
}

getColorIndexes, .


function getColorIndexes(x,y,width) {
	var R = 4*(width*y + x);
	return [R,R+1,R+2];
}

, Uint8ClampedArray , getImageData — . , , .. , V8 .


.
1) . DOM, .. , - .
2) . KGB RGB. ( ), . Main color .
3) , . isLocked true. «N», , isLocked


Profit! !



, , .




. , .


function basicProfitAnalisis(mask) {
	var maskInUse = mask;
	var result = [0,0];
	var currentBet = 50;
	var baseBet = 50;
	var maxBet = baseBet;
	var totalSum = 0;
	var multiplier = 0.82;

	for(var i = 1;i<maskInUse.length;i++) {
		if (maskInUse[i] == maskInUse[i-1]) {
			result[0]++; // .
			totalSum += currentBet*multiplier;
			currentBet = baseBet;
		} else {
			result[1]++; // .
			totalSum -= currentBet;
			currentBet *= 2;
			if (currentBet > maxBet) {
				maxBet = currentBet;
			}
		}
	}

	document.getElementById("betsWon").innerHTML += result[0];
	document.getElementById("betsLost").innerHTML += result[1];
	if (totalSum >= 0) {
		document.getElementById("pureChange").innerHTML += `<font 
                color='green'>${totalSum}</font>`;
	} else {
		document.getElementById("pureChange").innerHTML += `<font color='red'>${totalSum} 
                </font>`;
	}
	document.getElementById("maxBet").innerHTML += maxBet;

	setCookie("totalSum", parseInt(getCookie("totalSum"))+totalSum, 365);
}

. , . . , — . , , ( — 0.82, ) . , .


, . . . maxBet (, , , . ).


, , -.



. , . .



? — ?



… -, , . .



, .



?



! ? . — .



, .



.


, , , 10-:



?

, — , , , , 5 , . , , .


. . . , , , , , . 0. , , , 48.65% ( — 2.7%). «» — . . — 0.82 /. .


, , , , .



? ! , . , . . , , . , , .



, - / , , . .



, . , . ! , . , , .



, , .


, , . , . . , , ( ), … ? ?


, , , . , , :)



.



')

Source: https://habr.com/ru/post/420523/


All Articles