Its a pretty basic if statement, but i cant figure out the syntax.
Thanks.,
The nested If Statement on line 147
Code: Select all
xs:=20
If (ProfitMade > xs)
{
msgbox Dropped Higher Then 20
}
The Nested If Statements From The Code
Code: Select all
If (DetectPriceInArray2 > DetectPriceInArray1)
{
If PriceRiseDetected=No
{
DetectPrice1:=DetectPriceInArray1
DetectPrice2:=DetectPriceInArray2
;msgbox GoneUp From %DetectPrice1% To %DetectPrice2%
xs:=20
If (ProfitMade > xs)
{
msgbox Dropped Higher Then 20
}
GuiControl,, GoneUp, GoneUp From %DetectPrice1% To %DetectPrice2%
PriceRiseDetected=Yes
PriceLowerDetected=No
}
}
The Complete Code :
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance, Force
SetFormat,Float,3.2
;LTrim: Omits spaces and tabs at the beginning of each line
Loop 180
{
x++
FileReadLine, NewVarArray%x%, D:\Project\VSync\PriceTest.txt, %A_Index%
}
MyVar=
(
54000
54050
54100
54150
54200
54250
54300
54350
54400
54450
54500
54550
54600
54650
54700
54750
54800
54850
54900
54950
55000
53950
53900
53850
53800
53750
53700
53650
53600
53550
53500
53450
)
StringSplit, NewVarArray, MyVar, `n ; Separates a string into an pseudo-array
;MsgBox,% NewVarArray4
Gui, Add, Text,x10 w900 y20 vPrice , Price
Gui, Add, Text,x10 w900 y50 vGoneup , GoneUp
Gui, Show,h200 w900 x1600 y100,1x
TotalBought:=3000
PriceBoughtFor:=54000
CurrentPrice:=55000
Amount:=TotalBought/PriceBoughtFor
PercentageRisenBy:=(CurrentPrice-PriceBoughtFor)/(PriceBoughtFor/100)
ProfitMade:=(TotalBought*PercentageRisenBy)/100
;msgbox %ProfitMade% %PercentageRisenBy% %ProfitMade2%
loop
{
PriceRiseDetected=No
PriceLowerDetected=No
MainInc:=1
Detect2:=1
Loop 30
{
CurrentPrice:=NewVarArray%MainInc%
;Calc Profit Made
;1. Calc PercentageRisen By 55000-54000 / 54000/100 =1.81%
PercentageRisenBy:=(CurrentPrice-PriceBoughtFor)/(PriceBoughtFor/100)
;2. Multiply By TotalBought * PercentageRisenBy / 100 3000 * 1.81% / 100
ProfitMade:=(TotalBought*PercentageRisenBy)/100
GuiControl,, Price, %CurrentPrice% %ProfitMade% %PercentageRisenBy%
if Detect2 >= 2
{
FindPreviousPrice:=MainInc-1
DetectPriceInArray1:=NewVarArray%FindPreviousPrice%
;msgbox %DetectPriceInArray1%
DetectPriceInArray2:=NewVarArray%MainInc%
;msgbox %DetectPriceInArray2%
If (DetectPriceInArray2 > DetectPriceInArray1)
{
If PriceRiseDetected=No
{
DetectPrice1:=DetectPriceInArray1
DetectPrice2:=DetectPriceInArray2
;msgbox GoneUp From %DetectPrice1% To %DetectPrice2%
xs:=20
If (ProfitMade > xs)
{
msgbox Dropped Higher Then 20
}
GuiControl,, GoneUp, GoneUp From %DetectPrice1% To %DetectPrice2%
PriceRiseDetected=Yes
PriceLowerDetected=No
}
}
If (DetectPriceInArray2 < DetectPriceInArray1)
{
If PriceLowerDetected=No
{
;msgbox GoneDown From %DetectPrice1% To %DetectPrice2%
DetectPrice1:=DetectPriceInArray1
DetectPrice2:=DetectPriceInArray2
GuiControl,, GoneUp, GoneDown From %DetectPrice1% To %DetectPrice2%
If (ProfitMade <= -20)
{
msgbox Dropped Lower Then -20
}
PriceRiseDetected=No
PriceLowerDetected=Yes
}
}
Detect2:=0
}
Sleep 150
MainInc++
Detect2++
}
}
return
esc::
{
sleep 100
Send {LControl down}
sleep 100
Send {s}
sleep 100
Send {LControl up}
Reload
}
Return