-
Notifications
You must be signed in to change notification settings - Fork 0
/
support-resistance-lines.html
74 lines (70 loc) · 2.39 KB
/
support-resistance-lines.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Number Division and Addition</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
.container {
max-width: 600px;
margin: 0 auto;
}
.output {
margin-top: 20px;
font-size: 1.3rem;
}
.close {
background-color:beige;
}
</style>
</head>
<body>
<div class="container">
<h1>Position of the Planet in degrees</h1>
<form id="inputForm">
<label for="number">Number:</label>
<input type="number" id="number" required>
<br><br>
<!-- 2, 4, 8, .... -->
<!-- 0.5, 0.25, 0.125, ...s -->
<label for="factor">Division Factor:</label>
<input type="number" step="0.01" id="factor" required>
<br><br>
<label for="current_price">Exactly what the currently price is:</label>
<input type="number" step="1.0" id="current_price" >
<br><br>
<button type="button" onclick="calculate()">Calculate</button>
</form>
<div class="output" id="output"></div>
</div>
<script>
function calculate() {
const number = parseFloat(document.getElementById('number').value);
const factor = parseFloat(document.getElementById('factor').value);
const current_price = parseFloat(document.getElementById('current_price').value);
const outputDiv = document.getElementById('output');
outputDiv.innerHTML = ''; // Clear previous output
if (isNaN(number) || isNaN(factor)) {
outputDiv.innerHTML = 'Please enter valid numbers.';
return;
}
let result = number * factor;
let sum = result;
const max = 44000;
while (sum <= max) {
const p = document.createElement('p');
p.textContent = sum;
if (sum - (360*factor) < current_price && current_price < sum + 2*(360*factor)) {
p.classList.add("close");
}
outputDiv.appendChild(p);
sum += (360 * factor);
}
}
</script>
</body>
</html>