|
|
Project title: |
VBA to Google sheet script
|
Posted by: |
External project from PeoplePerHour
|
Started: |
21-Nov-2020 00:45 GMT |
Description: |
I would like to change a VBA macro in excel to a googlesheet script. :
function MonteC1() {
' Macro1 Macro ' Macro recorded by Kevin Davey - www.kjtradingsystems.com
' Do not change anything in this macro, unless you absolutely know what you are doing.
Worksheets(1).EnableCalculation = False 'manually calculate to allow faster processing
timex = Time Randomize (Timer)
'first clear last results Range("E4:k14").Select Selection.ClearContents startequity = Range("B2") equityincrement = startequity / 4# margin = Range("b3") 'this is also the ruin number
lotsize = 1 'always trade 1 contract
trades = Range("B4") 'trades in one year
niters = 2500 'run full simulation 2500 times
'find the last row that has data in it i = 10 Do Until (Range("A" & i) = "") i = i + 1 Loop lastrow = i - 1
' upperbound = lastrow - 10 + 1 'total # of trades in group
irow = 4 'for the output
'copy cells for output up until last iteration Range("w1:aa5000").Select Selection.ClearContents
For c1 = startequity To startequity + 10 * equityincrement Step equityincrement
Beginequity = c1
totalriskofruin = 0
For Iteration = 1 To niters
equity = Beginequity drawdown = 0#
maxequity = equity ruin = 0
For itrades = 1 To trades
'MsgBox "itrades " & itrades & " " & ruin & " " & equity & " equity"
'Int((upperbound - lowerbound + 1) * Rnd + lowerbound) tradenumber = Int(((lastrow - 10 + 1) * Rnd) + 10)
tradevalue = Range("A" & tradenumber)
ncontracts = lotsize
'don't trade if equity is below margin for one lot (you are RUINED) If equity drawdown Then drawdown = dd End If
Next itrades
totalriskofruin = totalriskofruin + ruin ' MsgBox " totalriskofruin " & totalriskofruin & " " & Iteration & " iteration"
Range("w" & Iteration) = equity Range("x" & Iteration) = drawdown Range("y" & Iteration) = ((equity / c1) - 1) 'rate of return in decimal If drawdown 0
Worksheets(1).EnableCalculation = False 'auto calculate to allow faster processing irow = irow + 1
Next c1
Worksheets(1).EnableCalculation = True 'auto calculate to allow faster processing
Range("a1").Select
'MsgBox "time is " & (Time - timex) * 60 * 60 * 24 Beep End Sub } |
Project ID:
|
3109367 |
Project category: |
|
Project budget: |
|
|
|
|
Project |
Started |
React Native Incoming Call Modal
Category: Android, HTML5, IPhone, JavaScript, Mobile App Development Budget: ₹600 - ₹1500 INR |
18-May-2024 21:53 GMT |
05-18-2024 Data Miner Expert
Category: Data Mining, Database Development, Google Spreadsheets, Research Budget: $2 - $8 USD |
18-May-2024 21:52 GMT |
Console Football Game Development
Category: Game Design, Game Development, IPhone, Mobile App Development, Unity 3D Budget: $250 - $750 USD |
18-May-2024 21:52 GMT |
Expert in SharePoint, Power Apps, Automate & Power BI
Category: .NET, C#, Programming, Microsoft, Sharepoint, WPF Budget: $10 - $12 USD |
18-May-2024 21:52 GMT |
Logo News Page
Category: Graphic Design, Illustration, Logo Design, Photoshop, Web Design Budget: €8 - €30 EUR |
18-May-2024 21:49 GMT |
Turkish Recording Project -- 92455
Category: Audio Services, English (US) Translator, Translation, Turkish Translator, Voice Talent Budget: $4 - $5 USD |
18-May-2024 21:48 GMT |
Amazon Sales Boost through Listing Optimization
Category: Internet Marketing, Marketing, Sales, Search Engine Marketing (SEM), SEO Budget: $30 - $250 USD |
18-May-2024 21:46 GMT |
Illustrative Instagram Post Creation
Category: Caricature & Cartoons, Graphic Design, Illustration, Photoshop Budget: $30 - $250 USD |
18-May-2024 21:46 GMT |
Make One Existing Webpage Responsive -- 2
Category: CSS, HTML, HTML5 Budget: $10 - $50 USD |
18-May-2024 21:45 GMT |
All-Genre Roles for Various Platforms
Category: Acting, Training Budget: $200 - $30000 AUD |
18-May-2024 21:45 GMT |
90K Erotic Romance Manuscript Editing
Category: Book Writing, Creative Writing, Editing, Fiction, Ghostwriting Budget: $750 - $1500 USD |
18-May-2024 21:45 GMT |
Erotic Romance Manuscript 50k+ Words Editing
Category: Book Writing, Editing, Fiction, Ghostwriting, Proofreading Budget: $250 - $750 USD |
18-May-2024 21:45 GMT |
Sports Complex Exterior Design
Category: 3D Modelling, 3D Rendering, Building Architecture, Home Design Budget: $15 - $25 USD |
18-May-2024 21:43 GMT |
Minimalistic Logo Design & Branding
Category: Branding, Illustration, Logo Design, Marketing Strategy, Photoshop Budget: $750 - $1500 USD |
18-May-2024 21:41 GMT |
WooCommerce & Google Sheet API Project
Category: Google Apps Scripts, Google Sheets, PHP, WooCommerce, WordPress Budget: $30 - $250 USD |
18-May-2024 21:38 GMT |
|
Browse All Projects
|
|
|
|
|